Choose your database:
AnySQL
MySQL
MS SQL Server
PostgreSQL
SQLite
Firebird
Oracle
SQL Anywhere
DB2
MaxDB

Subscribe to our news:
Partners
Testimonials
Tracy J Powell: "Thank you VERY much for the quick and helpful response. I will definitely upgrade as soon as possible. Your products are great and I use them daily".
Albert Rognan: "Thank you for this quick reply. I must say I am impressed of the number of functions that is available within this tool".

More

Add your opinion

MS SQL Maestro online Help

Prev Return to chapter overview Next

Rules

A SQL Server rule is a Transact-SQL syntax element that defines a data-integrity constraint. A rule can be bound to a column or user-defined data type. The condition is executed to validate data for a single column when a value is inserted into the column bound by the rule. A rule condition can be any expression valid in a WHERE clause and can include elements such as arithmetic operators, relational operators, and predicates (for example, IN, LIKE, BETWEEN). Rules will be removed in the future versions of Microsoft SQL Server. Avoid using rules in new development work, and be ready to modify the applications that currently use it. We recommend that you use check constraints instead.

 

 

New rules are created within Create Rule Wizard. In order to run the wizard you should either

 

select the Object | Create Database Object... main menu item;
select the Rule icon in the Create Database Object dialog

or

select the Rules list or any object from that list in the explorer tree;
select the Create New Rule... item from the popup menu

or

open the schema in Schema Editor and the Rules tab there;
press the Insert key or select the Create New Rule... item from the popup menu (alternatively, you may use the corresponding link of the Navigation Bar).

 

To create a new rule with the same properties as one of the existing rules has:

 

select the Object | Duplicate Database Object... main menu item;
follow the instructions of Duplicate Object Wizard.

 

 

 

Rules can be edited within Rule Editor. In order to run the editor you should either

 

select the rule for editing in the explorer tree (type the first letters of the rule name for quick search);
select the Edit Rule... item from the popup menu

or

open the schema in Schema Editor and the Rules tab there;
select the rule to edit;
press the Enter key or select the Edit Rule item from the popup menu (alternatively, you may use the corresponding link of the Navigation Bar).

 

You can change the name of the rule using the Rename Rule dialog. To open the dialog you should either

 

select the rule to rename in the explorer tree;
select the Rename Rule item from the popup menu

or

open the schema in Schema Editor and the Rules tab there;
select the rule to rename;
select the Rename Rule item from the popup menu (alternatively, you may use the corresponding link of the Navigation Bar).

 

 

 

To drop a rule:

 

select the rule to drop in the explorer tree;
select the Drop Rule item from the popup menu

or

open the schema in Schema Editor and the Rules tab there;
select the rule to drop;
press the Delete key or select the Drop Rule item from the popup menu (alternatively, you may use the corresponding link of the Navigation Bar)

and confirm dropping in the dialog window.

 



Prev Return to chapter overview Next