This documentation is archived and is not being maintained.

Working with Constraints

Constraints are rules that the database server enforces for you. For more information see Constraints.

For details about working with constraints, see the following topics:

To See
Attach a check constraint to a table to specify the data values that are acceptable in one or more columns Attaching a New Check Constraint to a Table or Column
Create a constraint expression to check data for a condition Defining a Check Constraint Expression
Change the constraint expression or the options that enable or disable the constraint for specific conditions Modifying a Check Constraint
Apply constraints either to new data only or to existing data as well Checking Existing Data When Creating a Check Constraint
Disable a check constraint when data is added to, updated in, or deleted from a table Disabling a Check Constraint with INSERT and UPDATE Statements
Disable a check constraint when your table is replicated in another database Disabling a Check Constraint for Replication
Remove the limitations on data values in a column Deleting a Check Constraint
Ensure no duplicate values are entered in specific columns Creating a Unique Constraint
Change the columns that the constraint is attached to, change the constraint name, or set additional properties for the constraint Modifying a Unique Constraint
Remove the requirement for uniqueness for values entered in the column Deleting a Unique Constraint
Enforce uniqueness for values entered in specified columns Defining a Primary Key
Change the column order, index name, clustered option, or fill factor Modifying a Primary Key
Copy column properties from a primary key column to a foreign key column to relate the two columns Copying Column Properties to a Foreign Key Column
Remove the requirement for uniqueness for the values entered in a column Deleting a Primary Key Constraint
See which columns participate in the foreign key side of a relationship Viewing Foreign Key Attributes
Change which columns are related to columns in the primary key table Modifying a Foreign Key
Check existing data when creating a relationship Checking Existing Data when Creating a Relationship
Disable a foreign key constraint during INSERT and UPDATE transactions Disabling a Foreign Key Constraint with INSERT and UPDATE Statements
Disable a foreign key constraint during replication of the table Disabling a Foreign Key Constraint for Replication
Remove the requirement to enforce referential integrity between primary key columns and the related columns in another table Deleting a Foreign Key Constraint
Show: