Modify Check Constraints
You can modify a check constraint in SQL Server 2012 by using SQL Server Management Studio or Transact-SQL when you want to change the constraint expression or the options that enable or disable the constraint for specific conditions.
In This Topic
Before you begin:
Security
To modify a check constraint 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 modify a check constraint
In the Object Explorer, right-click the table containing the check constraint and select Design.
On the Table Designer menu, click Check Constraints….
In the Check Constraints dialog box, under Selected Check Constraint, select the constraint you wish to edit.
Complete an action from the following table:
To
Follow these steps
Edit the constraint expression
Type the new expression in the Expression field.
Rename the constraint
Type a new name in the Name field.
Apply the constraint to existing data
Select the Check Existing Data on Creation or Enabling option.
Disable the constraint when new data is added to the table or when existing data is updated in the table.
Clear the Enforce Constraint for INSERTs and UPDATEs option.
Disable the constraint when a replication agent inserts or updates data in your table.
Clear the Enforce For Replication option.
Note
Some databases have different functionality for check constraints.
Click Close.
On the File menu, click Save table name.
[Top]
Using Transact-SQL
To modify a check constraint
To modify a CHECK constraint using Transact-SQL, you must first delete the existing CHECK constraint and then re-create it with the new definition. For more information, see Delete Check Constraints and Create Check Constraints.
[Top]