411 REFERENCE · Wikibooks
Granite WMS/SQL/Granite
Reference material by Wikibooks contributors. This retains its source identity and is not 411 news reporting.
Delete all data in database except for the required setup data.
EXEC sp_msforeachtable "ALTER TABLE ? NOCHECK CONSTRAINT all"
EXEC sp_MSforeachtable 'IF OBJECT_ID(?) NOT IN (ISNULL(OBJECT_ID([dbo].[Type]),0),ISNULL(OBJECT_ID([dbo].[Status]),0),ISNULL(OBJECT_ID([dbo].[BarcodeMaster]),0),ISNULL(OBJECT_ID([dbo].[ScannerSettings]),0),ISNULL(OBJECT_ID([dbo].[IntegrationSettings]),0),ISNULL(OBJECT_ID([dbo].[Status]),0),ISNULL(OBJECT_ID([dbo].[Status]),0))DELETE FROM ?'
EXEC sp_msforeachtable "ALTER TABLE ? WITH CHECK CHECK CONSTRAINT all"