Created
January 19, 2015 12:53
-
-
Save bvanskiver/fde79ed437da4d036481 to your computer and use it in GitHub Desktop.
Disable all foreign key constraints
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Disables all FK constraints | |
exec sp_msforeachtable 'ALTER TABLE ? NOCHECK CONSTRAINT all' | |
-- Enables all FK constraints | |
exec sp_msforeachtable 'ALTER TABLE ? WITH CHECK CHECK CONSTRAINT all' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment