IBM Books

Adding check constraints when altering a table

Use the Check Constraints page of the Alter Table notebook to add check constraints to your table. A check constraint sets restrictions on data added to the table. Check constraints are enforced when rows in the table are inserted or updated.

You can define a check constraint that references a single column by specifying that column in the Check condition box.

You can add, change, or remove new check constraints for your table.

Graphic of Controls push button appears here. Graphic of Overview push button appears here.
Figure rule not displayed.

Before you begin...
Figure rule not displayed.

To add new check constraints:

  1. Open the Alter Table notebook.

  2. Click on the Check Constraints tab.

  3. Click on Add. The Add Check Constraint window opens.

  4. In the Check condition box, specify the check condition for the constraint that you're defining.

  5. Optional: In the Constraint name field, type a name for the check constraint.

  6. Optional: In the Comment field, type a comment to document the new check constraint.

  7. Click on Add to add the new check constraint.

  8. Repeat steps 4 through 7 to add another check constraint.

  9. Click on Close to close the Add Check Constraint window.

  10. If you do not want to make any additional changes to the table, click on OK to alter your table and close the Alter Table notebook. Otherwise, continue on to one or more of the optional tasks.

Figure rule not displayed.

Related information

[ Top of Page | Table of Contents | Glossary | Index ]

[ DB2 List of Books | Search the DB2 Books ]