Creating a Column Check Constraint

Create a column check constraint in ASE or Sybase IQ to limit the data that can be inserted into a table column according to a specified condition.

Prerequisites 

Before you can create a column check constraint, be sure that the data server containing the table for which you are creating a check constraint is running, and you created and established a connection to the data server.

  1. Expand the Tables folder.
  2. Right-click the table, and select New > Column Check Constraint from the context menu.

    The New Column Check Constraint wizard opens.

  3. Specify properties for the new check constraint.
    Field Description
    Filter column by name pattern Optionally enter a filter expression for columns to be displayed in the list of available columns. For example, * will list all columns for the specified table.
    Columns This is a list of columns available for defining a column check constraint. You can sort the list of columns by clicking on Column Name above the list. To add a constraint for a specified column, click Add Constraint, which generates a list item for the corresponding column in the Check constraints field.
    Check constraints This field lists check constraints for the specified column:
    • Existing: Checked if the defined constraint already exists.
    • Constraint Name: Auto-generated by default. You can enter your own constraint name.
    • Column Name: The specified column.
    • Definition: To define a constraint, click in this field, and click ... to open the Check constraint definition dialog, where you can type an expression defining the constraint.
    Use Delete and Delete All to remove defined constraints from the Check constraints list.
  4. Click Next, and specify save and execution properties for the column check constraint.
    Field Description
    Generate script Select this option to generate DDL in a script file for the column check constraint.
    Enter or select the parent folder Specify an existing project or create a new project in which to save the DDL.
    File name Enter the name of the file in which to store the DDL.
    Execute immediately Execute the DDL immediately. If you do not select this option, you must complete execution of the DDL in the script file you specified to create the column check constraint.
    Open in editor after creation Create the column check constraint, and then open it in the Table Schema Editor.
  5. Click Finish to create the column check constraint.
Related concepts
Check Constraints
Related tasks
Editing a Column Check Constraint
Dropping a Column Check Constraint
Creating a Unique Constraint
Creating a Check Constraint

For product-related issues, contact Sybase Technical Support at 1-800-8SYBASE. Send your feedback on this help topic directly to Sybase Technical Publications: pubs@sybase.com