Modify Check Constraints

 

Applies To: SQL Server 2016

THIS TOPIC APPLIES TO: yesSQL Server (starting with 2016)yesAzure SQL DatabaseyesAzure SQL Data Warehouse yesParallel Data Warehouse

You can modify a check constraint in SQL Server 2016 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

Security

Permissions

Requires ALTER permission on the table.

To modify a check constraint

  1. In the Object Explorer, right-click the table containing the check constraint and select Design.

  2. On the Table Designer menu, click Check Constraints….

  3. In the Check Constraints dialog box, under Selected Check Constraint, select the constraint you wish to edit.

  4. Complete an action from the following table:

    ToFollow these steps
    Edit the constraint expressionType the new expression in the Expression field.
    Rename the constraintType a new name in the Name field.
    Apply the constraint to existing dataSelect 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.
    System_CAPS_ICON_note.jpg Note


    Some databases have different functionality for check constraints.

  5. Click Close.

  6. On the File menu, click Savetable name.

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.

Community Additions

ADD
Show: