Export (0) Print
Expand All

Modify Check Constraints

 

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

Requires ALTER permission on the table.

Arrow icon used with Back to Top link

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:

    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.

    System_CAPS_noteNote

    Some databases have different functionality for check constraints.

  5. Click Close.

  6. On the File menu, click Save table name.

Arrow icon used with Back to Top link

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.

Arrow icon used with Back to Top link

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2015 Microsoft