RULES are SQL Server objects used to implement restrictions and checks on data in a column. A single created RULE may be bind to many columns. Suppose we have a RULE created. This rules specify that minimum DOB of an employee being entered should always be greater than or equal to 18 years. Now once RULE is created then it can be bind to many columns of date of birth in different tables. And all bind columns will accept date of birth greater than or equal to 18 years of age.
To bind a column DOB in Employees table following is syntax
Use Databasename GO EXEC sp_bindrule ‘MinDOB’, ‘Employees.DOB’ GO
Similarly same RULE may be bind to as many columns in a database as required. Now in order to drop a RULE, it should be first unbind from all bind columns. So to unbind MinDOB from [Employees].[DOB] following is the syntax
Use Databasename GO EXEC sp_unbindrule ‘Employees.DOB’ GO
For details of creating and using rules and defaults in SQL Server please read my article on MSSQLTips.com