Disable all constraints of all tables in a database using SQL Server

If you are looking out for a fast and a simple way of disabling all constraints of all tables in a database using SQL Server, then here is a undocumented stored procedure that helps you achieve the same

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

No comments:

Post a Comment