Wednesday, October 21, 2009

System Stored Procedure - sp_msforeachtable


-- enable all constraints
exec sp_msforeachtable @command1="print '?'", @command2="ALTER TABLE ? WITH CHECK CHECK CONSTRAINT all"

sp_msforeachtable "ALTER TABLE ? DISABLE TRIGGER all"

sp_msforeachtable @command1="print '?'", @command2="ALTER TABLE ? ENABLE TRIGGER all"