-- Disable FOREIGN KEY and CHECK constraints for all tables in DB EXEC sp_MSforeachtable @command1="ALTER TABLE ? NOCHECK CONSTRAINT ALL" -- Truncate tables TRUNCATE TABLE dbo.mytable1 TRUNCATE TABLE dbo.mytable2 ... -- Enable FOREIGN KEY and CHECK constraints for all tables in DB EXEC sp_MSforeachtable @command1="ALTER TABLE ?CHECK CONSTRAINT ALL"