You can add a CHECK constraint to an existing table using ALTER TABLE and ADD CONSTRAINT.
The syntax is as follows:
ALTER TABLE table_name
WITH CHECK | WITH NOCHECK
ADD CONSTRAINT constraint_name
CHECK ( logical_expression )
CHECK With the CHECK option (the default), existing data is validated against the new CHECK constraint.
WITH NOCHECK NOCHECK skips validation of new data, limiting the constraint to validation of new values (inserted or updated).
|