What is the difference between a check constraint and a rule?
Ankur Jain
The major difference between rule and Check is re usability. Check constraint is associated with columns in a Table. So these can't be re-used. Rules are defined with in a database and can be applied to any number of columns.
There are a lot of difference but One the most notable difference is that we can bind rules to a datatypes whereas constraints are bound only to columns. this feature enable us to create our own data-type with the help of Rules and get the input according to that.
Rules are a backward-compatibility feature that performs some of the same functions as CHECK constraints. CHECK constraints are the preferred, standard way to restrict the values in a column. CHECK constraints are also more concise than rules; there can only be one rule applied to a column, but multiple CHECK constraints can be applied. CHECK constraints are specified as part of the CREATE TABLE statement, while rules are created as separate objects and then bound to the column.
There are a lot of difference but One the most notable difference is that we can bind rules to a datatypes whereas constraints are bound only to columns. this feature enable us to create our own data-type with the help of Rules and get the input according to that
http://www.codeproject.com/Questions/609687/DifferenceplusbetweenplusConstraintsplusandplusRul
Check constraints and rules limit the range of values that a user can enter into a column. Whereas check constraints apply only to the table for which you enter them, you can apply rules to multiple tables.