A CHECK condition applied as a constraint on the table typically ensures that two values in a row being added or modified have a proper relation to each other.
When you give a name to the constraint, the constraint is held individually in the system tables, and you can replace or drop them individually. Since this is more flexible behavior, it is recommended that you either name a CHECK constraint or use an individual column constraint wherever possible.
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:
ALTER TABLE Employees ADD CONSTRAINT valid_term_date CHECK( TerminationDate >= StartDate );
For more information, see ALTER TABLE statement.
|Discuss this page in DocCommentXchange.
Send feedback about this page using email.
|Copyright © 2009, iAnywhere Solutions, Inc. - SQL Anywhere 11.0.1|