Adding check constraints
These steps are part of the larger tasks of creating a table
and altering a table. When
you complete the steps for adding check constraints, return to
either creating a table
or altering a table.

To add check constraints:
-
In the Add Check Constraint window, in the Check
condition box, specify the check condition for the constraint that
you're defining.
If you are adding the check constraint when altering a table and the table
has data, the way that the new check constraint is enforced on the existing data depends
on the value of the CURRENT RULES special register:
- If CURRENT RULES is set to 'DB2', the check constraint is not immediately
enforced. It is added to the description of the table, and the table space
that contains the table is placed in a check pending status. To clear
the check pending status, you need to check the data on the table space.
For more information, see
checking data in table spaces.
- If CURRENT RULES is set to 'STD', the existing rows are checked against
the check constraint. If no violations occur, the check constraint is added
to the table. If any rows violate the new check constraint, an error occurs
and the check constraint is not added to the table's description.
-
Optional: In the Constraint name box, type a name for the check
constraint. If you do not specify a constraint name, one is generated for
you.
-
Click Apply to add the new check constraint.
-
Repeat steps 1 through 3 to add another check constraint to your table.
-
Click Close to close the Add Check Constraint window.
Depending on the task that you were doing when you added this check constraint,
return to
either creating a table
or altering
a table.