Disable Check Constraints with INSERT and UPDATE Statements
You can disable a check constraint for INSERT and UPDATE transactions in SQL Server 2012 by using SQL Server Management Studio or Transact-SQL. After you disable the check constraints, future inserts or updates to the column will not be validated against the constraint conditions. Use this option if you know that new data will violate the existing constraint or if the constraint applies only to the data already in the database.
In This Topic
Before you begin:
Security
To disable a check constraint for INSERT and UPDATE statements, using:
SQL Server Management Studio
Transact-SQL
Before You Begin
Security
Permissions
Requires ALTER permission on the table.
[Top]
Using SQL Server Management Studio
To disable a check constraint for INSERT and UPDATE statements
In Object Explorer, expand the table with the constraint and then expand the Constraints folder.
Right-click the constraint and select Modify.
In the grid under Table Designer, click Enforce For INSERTs And UPDATEs and select No from the drop-down menu.
Click Close.
[Top]
Using Transact-SQL
To disable a check constraint for INSERT and UPDATE statements
In Object Explorer, connect to an instance of Database Engine.
On the Standard bar, click New Query.
Copy and paste the following examples into the query window and click Execute.
USE AdventureWorks2012; GO ALTER TABLE Purchasing.PurchaseOrderHeader NOCHECK CONSTRAINT CK_PurchaseOrderHeader_Freight; GO
For more information, see ALTER TABLE (Transact-SQL).
[Top]