Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 

Rules, Defaults and the SQL Standard

By Tony Davis, 2008/06/23

Total article views: 109 | Views in the last 30 days: 2

I see, with some relief that the threatened removal of Rules and Defaults in SQL Server 2008 hasn’t happened. There has been a stay of execution. Even though they are documented, they still come with a dire warning that they are deprecated and will be removed in future versions. They have fallen foul of the SQL Standards committee, and we are now supposed to use check constraints instead.

For me, RULEs and DEFAULTs have a certain magic.  Where you require a complex data type based on a built-in one, but with complex validation rules, and default values, there is no way quite so simple to make it happen. I know that, because you can use a user-defined function in a check constraint, you can do almost as well, but it still means that you have to define lots of check constraints all over the database. It is so much easier to define a user-defined data type, and bind the RULE and DEFAULT to it. Whenever you have a table with your user-defined data type, the RULE and DEFAULT comes free.  (For a demonstration of this, see Robyn Page’s SQL Server Data Validation Workbench)

It made me brood once more about the SQL Standards. It is difficult to think of any other standard that has diverged so far from what the ordinary user wants. What is worse, they make you pay good money, payable in Swiss Francs in the case of ISO, to see the latest standard. What a contrast ANSI and ISO are with W3C, who have produced an excellent draft of HTML5.The latter is a consensus document that reflects the needs of all users, not just the wild theoreticians and ‘researchers’ who, as delegates, tend to drive the ISO committees, despite the excellent and enduring work of  Keith Hare and Jim Melton. The HTML5 draft standard is public, is free to browse, and if you have a valid point, they listen. Maybe it is time for some free enterprise: start a rival SQL standards body to ISO, a divergence in the same way that XHTML has forked from HTML, so as to liberate SQL’s future.

That would be fun. Just so long as the process was driven by real day-to-day users.

Cheers,

Tony.

By Tony Davis, 2008/06/23

Total article views: 109 | Views in the last 30 days: 2
Your response
 
 
Related Articles
SCRIPT

Fix Default Constraint Naming

This stored procedure can be used for applying a custom default constraint naming

SCRIPT

Fix Default Constraint Naming

This stored procedure can be used for applying a custom default constraint naming

FORUM

Creating a Check Constraint

Check Constraint

ARTICLE

Automate Default Constraints

One procedure that will take care of all default constraint values in the destination.

SCRIPT

Fix Column Check Constraint Naming

This stored procedure can be used for applying a custom column check constraint naming convention

Tags
database weekly    
editorial    
 
Contribute

Join the most active online SQL Server Community

SQL knowledge, delivered daily, free:

Email address:  

You make SSC a better place

As a member of SQLServerCentral, you get free access to loads of fresh content: thousands of articles and SQL scripts, a library of free eBooks, a weekly database news roundup, a great Q & A platform… And it’s our huge, buzzing community of SQL Server Professionals that makes it such a success.

Join us!

Steve Jones
Editor, SQLServerCentral.com

Already a member? Jump in:

Email address:   Password:   Remember me: Forgotten your password?
Steve Jones