DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Snippets has posted 5883 posts at DZone. View Full User Profile

Enable Disable All The Constraints Of Data Base Sql Server

01.28.2012
| 4814 views |
  • submit to reddit
        // enable disable all the constraints of data base sql server


---For ENABLING

EXEC sp_MSforeachtable @command1="ALTER TABLE ? NOCHECK CONSTRAINT ALL"

---To DISABLE all the constraints
EXEC sp_MSforeachtable @command1="ALTER TABLE ? CHECK CONSTRAINT ALL"
GO