Showing posts with label Disable and Enable all the constraints in a SQL database. Show all posts
Showing posts with label Disable and Enable all the constraints in a SQL database. Show all posts

Thursday, February 19, 2015

Disable and Enable all the constraints in a SQL database


 Disable all the constraint in database

 EXEC sp_msforeachtable "ALTER TABLE ? NOCHECK CONSTRAINT all"  


Enable all the constraint in database

 EXEC sp_msforeachtable "ALTER TABLE ? WITH CHECK CHECK CONSTRAINT all"