You can bind a rule to to a user-defined data type, so it will then apply to any column where the datatype is used. The interface was not implemented with any enthusiasm.

validating sql-59

Rules are the best way of ensuring that business rules, especially those that are liable to change, are implemented in one place only.

As mentioned above, Rules are considered deprecated in SQL Server 2005.

If you need to perform a fairly complex check, and it has to be done in more than one table, then a rule is very handy.

One rule can be referenced from any number of tables or user-defined data types in the database. You can create a rule easily in EM or SMSS but don’t even think about altering the rule if you have bound it to an object.

Yammer not only develops new features, but is continuously looking for ways to improving existing ones.

Like many software companies, Yammer frequently tests these features before releasing them to all of thier customers.Normally, you’d want to put the whole messy business of checking that the format is valid into a stored procedure, as well as requiring that the front-end applications do all the appropriate filtering. Whatever happens, complex code like this must be kept in one place and heavily documented.Postcode validation criteria are as follows (slightly simplified): With that done we can then bind the rule to a column of a table.In the real world, however, and particularly if the real world includes programmers using ‘Dynamic SQL’, or data feeds into tables and so on, then they are a vital defence for the integrity of your data.There are several different ways of putting constraints and checks on data, and the purpose of this workshop is just to point out the odd quirk that might be of practical help, whilst running through the list.You can bind a rule to as many columns as you wish within the database: it keeps everything neat without duplication of the implementation of business rules.