How to Enable All Constraints back in the Database in SQL Server ?

Published on December 11, 2013 by abundantcode

Filed under SQL Server

Last modified December 11, 2013

Print this page

rate 1 star rate 2 star rate 3 star rate 4 star rate 5 star
Your rating: none, Average: 0 (0 votes)

This article have been viewed 3114 times

In one of the articles , we explained How to Disable All Constraints in the Database temporarily in SQL Server ? , let’s look at the option of how to enable back the constraints in the SQL Server Database.

How to Enable All Constraints back in the Database in SQL Server ?

Below is a sample query that enables all the constraints back to the database in SQL Server.

Use ACDatabase
Go
exec sp_msforeachtable @command="ALTER TABLE ? WITH CHECK CHECK CONSTRAINT all"
If you enjoyed this post, please consider leaving a comment or subscribing to the RSS feed to have future articles delivered to your feed reader.

Leave a Comment


x

You might be Interested in these Posts

How to Enable or Disable Visual Styles in your VB.NET Winforms Application?

You can enable or Disable the Visual Styles in your VB.NET Winforms Application by following the bel...

How to Perform Inner Join using LINQ in C# ?

Are you looking for the syntax on how to perform inner join using LINQ in C# ? . Below is a sample c...

How to Disable All Constraints in the Database temporarily in SQL Server ?

There are times when you may want to disable all the constraints in the your SQL Server Database tab...