Sybase Rules

Sybase Rules specifies what we can or can’t allowed to enter in a particular column or in any column with a given user-defined datatype.

Steps involved in Sybase rules creation

  • We can create rule using create rule syntax.
  • Then, we can bind the rule to a table using sp_bindrule stored procedure.
  • Then, test the rule by inserting data into respective table.

Sybase Rule create syntax:

create rule [owner.]rule_name
as condition_expression

Example:
Here is how the rule permitting five different pub_id numbers and one dummy value (99 followed by any two digits) was created:

create rule pub_idrule
as @pub_id in (“1389”, “0736”, “0877”, “1622”, “1756”)
or @pub_id like “99[0-9][0-9]”

Powered by k2schools