Click here to view and discuss this page in DocCommentXchange. In the future, you will be sent there automatically.

SQL Anywhere 11.0.0 » Context-Sensitive Help » SQL Anywhere plug-in help » Introduction to SQL Anywhere properties windows

 

Check Constraint Properties window: Definition tab

This tab has the following components:

This check constraint has the following definition   Provides a place for you to type the check constraint. A column check constraint is used to ensure that no inappropriate values are entered into any column of the specified type, while a table check constraint ensures that no row in a table violates the constraint.

Column check constraint example

You can enforce a particular formatting requirement. For example, if a table has a column for phone numbers you may want to ensure that users enter them all in the same manner. For North American phone numbers, you could use a constraint such as:

CHECK ( Phone LIKE '(___) ___-____' );

Once this CHECK condition is in place, if you attempt to set a Phone value to 9835, for example, the change is not allowed.

Table check constraint example

For example, you can add a constraint on the Employees table to ensure that the TerminationDate is always later than, or equal to, the StartDate:

CHECK(TerminationDate >= StartDate);
See also