Created
January 2, 2013 12:17
-
-
Save WizzApp/4434172 to your computer and use it in GitHub Desktop.
Delete all data from all tables ignoring foreign keys
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
-- Taken from http://stackoverflow.com/a/1899881/278708 | |
EXEC sp_MSForEachTable 'ALTER TABLE ? NOCHECK CONSTRAINT ALL' | |
GO | |
EXEC sp_MSForEachTable 'DELETE FROM ?' | |
GO | |
EXEC sp_MSForEachTable 'ALTER TABLE ? CHECK CONSTRAINT ALL' | |
GO |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment