
-- NOTE: do NOT clear table UIDGEN.  Doing so could produce duplicate
-- IDs which are visible to external program.  Also do not clear
-- FIPERSYS with schema version info.

-- Note we use TRUNCATE instead of DELETE so table space is released.

GO
truncate table ACCESSCONTROLLIST;
truncate table ACSPKIDESCRIPTOR;
truncate table AFFINITYGROUPBEAN;
truncate table APPROXDATA;
truncate table DATA_TYPES;
truncate table DBVERSIONCONTROLLER;
truncate table DEFAULTACL;
truncate table FILESERVERDETAIL;
truncate table FILESTORE;
truncate table GROUPMASTER;
truncate table GROUPUSERMAP;
truncate table HIERARCHYMASTER;
truncate table JOBBEAN;
truncate table JOBLOGDATABEAN;
truncate table JOBMODEL;
truncate table JOBMONITOR;
truncate table JOBOWNER;
truncate table MASTERMODEL;
truncate table METAINFO;
truncate table OBJECTMASTER;
truncate table OBJECTNAMEVALUE;
truncate table OBJECTREFERENCELIST;
truncate table OBJECTVERSIONMASTER;
truncate table PARTNERPROFILEBEAN;
truncate table RESULTREQUESTREGISTRY;
truncate table STATIONBEAN;
truncate table SYNCPOINT;
truncate table TCBASICSEARCHPARMS;
truncate table TCMODEL;
truncate table TCPREFERENCES;
truncate table VERSIONCONTROLIMPLEMENTATION;
truncate table VERSIONCONTROLMASTER;
truncate table WORKCONTEXTBEAN;
truncate table WORKFLOWBEAN;
truncate table WORKITEMBEAN;
truncate table IMPORTDETAILS;
truncate table WORKITEMSUMMARY;
truncate table FIPERLOCK;
truncate table JOBVIEWDATA;
truncate table AFFINITIES;
truncate table BulletinBoard;
truncate table PARAMHISTORYBEAN;

-- Remove all job data (vertical schema) tables
Go

WHILE (select count(table_name) from INFORMATION_SCHEMA.TABLES  where table_name LIKE 'VS%')>0
BEGIN
   DECLARE @table_name varchar(max)

   SET @table_name =(SELECT TOP 1 table_name from INFORMATION_SCHEMA.TABLES  where table_name LIKE 'VS%')

   exec ('drop table ' +@table_name) 

END;
