Creating an ASE Rule

Create a database rule to specify the domain of acceptable values for a particular column or for any column of a user-defined datatype. You can create rules for only Adaptive Server Enterprise tables.

Prerequisites 

Before you can create a rule, be sure the data server on which you are creating the rule is running, and you created and established a connection to the data server.

  1. In the Databases folder in Enterprise Explorer, under the database connection profile, expand the Databases folder, and then expand the tree for a database and then the tree for the appropriate schema owner.
  2. Right-click the Rules folder and select New > Rule .
  3. Specify properties for the new rule.
    Field Description
    Owner Select an owner from the drop-down menu.
    Name Specify a name for the rule in the corresponding text field.
    Access Rule Specify the rule as an access rule, and choose And or Or from the drop-down.
    Rule Expression Specify the conditions that define the rule. The rule expression can be any expression that is valid in a where clause, and can include arithmetic operators, relational operators, in, like, between, and so on. However, it cannot reference a column or any other database object. Built-in functions that do not reference database objects can be included. A rule takes one argument. The argument is prefixed by the @ sign and refers to the value that is entered in the update or insert command. You can use any name or symbol to represent the value when you write the rule, but the first character must be the @ sign. Enclose character and date constants in quotes, and precede binary constants with “0x”.
    Preview Displays the DDL for creating the rule.
  4. Click Next, and specify save and execution properties for the rule
    Field Description
    Generate Script Generate DDL for the rule.
    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 later to create the rule.
    Open in Editor After Creation Create the rule, and then open it in the Rules Editor.
  5. Click Finish to create the rule.
Related tasks
Editing Table Schema Data
Creating a Default
Editing an ASE Rule
Renaming an ASE Rule
Dropping an ASE Rule

Send your feedback on this help topic to Sybase Technical Publications: pubs@sybase.com

Your comments will be sent to the technical publications staff at Sybase, Inc. For product-related issues or technical support, contact Sybase Technical Support at 1-800-8SYBASE.