Restrict Column Data: Rules

You can create a rule and bind it to a column or user-defined datatype. Rules govern the kind of data that can or cannot be added.

For example, a rule called pub_idrule, which specifies acceptable publisher identification numbers, is bound to the pub_id column of the publishers table. The acceptable IDs are “1389,” “0736,” “0877,” “1622,” “1756,” or any four-digit number beginning with “99.” If you enter any other number, you see an error message.

When you get this kind of error message, you may want to use sp_helptext to look at the definition of the rule:
sp_helptext pub_idrule 
(1 row affected) 
create rule pub_idrule 
as @pub_id in ("1389", "0736", "0877", "1622", "1756")
or @pub_id like "99[0-9][0-9]" 
(1 row affected)

For more general information on a specific rule, use sp_help, or, to find out if any of the columns has a rule, use sp_help with a table name as a parameter .

Related concepts
Defining Defaults and Rules for Data