EXEC sp_MSForEachTable 'ALTER TABLE ? NOCHECK CONSTRAINT ALL'
EXEC sp_MSForEachTable 'ALTER TABLE ? DISABLE TRIGGER ALL'
EXEC sp_MSForEachTable 'DELETE FROM ?'
--EXEC sp_MSForEachTable 'TRUNCATE TABLE ?
-- You cannot use TRUNCATE TABLE on a table referenced by a FOREIGN KEY constraint;
-- instead, use DELETE statement without a WHERE clause.
-- Because TRUNCATE TABLE is not logged, it cannot activate a trigger."
EXEC sp_MSForEachTable 'ALTER TABLE ? CHECK CONSTRAINT ALL'
EXEC sp_MSForEachTable 'ALTER TABLE ? ENABLE TRIGGER ALL'
-- reseed identity columns
EXEC sp_MSForEachTable '
IF OBJECTPROPERTY(object_id(''?''), ''TableHasIdentity'') = 1
DBCC CHECKIDENT (''?'', RESEED, 0)'
Geen opmerkingen:
Een reactie posten