Rules and defaults | SQL Server Performance Forums

SQL Server Performance Forum – Threads Archive

Rules and defaults

Hi, Can any one provide me information on creating rules and defaults in SQL Server2005, when i tried right clicking rules or defaults in management studio instead of new option i’am getting only refresh option. This feature was working smoothly in sql2000…..I’am trying this on Microsoft SQL Server2005 Standard Edition. thanks in advance Mat

Create Rule and Default are deprecated in SQL 2005 so that I think they removed this option in SSMS… BOL.. CREATE DEFAULT (Transact-SQL) CREATE RULE (Transact-SQL) Mohammed U.
Thanks Mohammed for the information and the links, so its possible through executing through Tsql , but i don’t understand why they removed that option as the management was very easy also to check the details of the constraints i don’t find any way as in sql2000 except script the constraint to a editor??????? Mat
Reason might be deprecation…
I don’t know exact answer why they deprecated…
Mohammed U.
why? . it may be because , rules and defaults are not ANSII compliant like check constraint. So it is not portable. Unlike check Constraints Rules and default have their own existence, so it has reusability. Check constraints are bounded to tables. Rules and default can be bounded to table and datatypes. There are pros and cons. But what I feel is ; by deprecating these object Microsoft is focusing on ANSII compliant Product.

BOL explains
Rules are a backward-compatibility feature that perform some of the same functions as CHECK constraints. Using CHECK constraints is the preferred, standard way to restrict the values in a column. CHECK constraints are also more concise than rules. There can be only 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.
This feature will be removed in a future version of Microsoft SQL Server. Avoid using this feature in new development work, and plan to modify applications that currently use this feature. Use CHECK constraints instead. For more information, see Constraints.
Satya SKJ
Microsoft SQL Server MVP
Contributing Editor & Forums Moderator
This posting is provided AS IS with no rights for the sake of knowledge sharing.