Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagesql
titleTruncate statements
truncate table EXTMY_INT_RDMSCHEMA.GD_STORE;
truncate table EXTMY_INT_RDMSCHEMA.GE_STORE;
truncate table EXTMY_INT_RDMSCHEMA.GI_STORE;
truncate table EXTMY_INT_RDMSCHEMA.MD_STORE;
truncate table EXTMY_INT_RDMSCHEMA.MI_STORE;
truncate table EXTMY_INT_RDMSCHEMA.SD_STORE;
truncate table EXTMY_INT_RDMSCHEMA.SE_STORE; 

Generate truncate statements in PostgreSQL:

...

Code Block
languagesql
titleTruncate statements for SQL Server
SELECT 'truncate table ' + TABLE_NAME + ';' + char(10) + 'go'
FROM SEMARCHY_PRODUCT_RETAIL_MDM.INFORMATION_SCHEMA.TABLES   /* amend Database Name to your database */
WHERE TABLE_NAME NOT LIKE 'DL_%' 
AND   TABLE_NAME NOT LIKE 'EXT_%'   /* Don't truncate these Semarchy system tables starting with DL and EXT */
AND   TABLE_NAME LIKE '%BRAND'      /* amend this line to meet your needs */
ORDER BY SUBSTRING(TABLE_NAME, 1, 3), TABLE_NAME
;

...

Code Block
languagesql
titleExample
truncate table AE_BRAND;
go
truncate table GD_BRAND;
go
truncate table GH_BRAND;
go
truncate table GX_BRAND;
go
truncate table SA_BRAND;
go


Info

This technique only removes the data, but does not remove the data structures (tables). For that purpose, you must drop the data location. This is great when you really want to start completely fresh, but you must use this option carefully. This is done from the Data Locations tab in the workbench.

...