SQLServerCentral Editorial

Rules, Defaults and the SQL Standard

,

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.

Rate

You rated this post out of 5. Change rating

Share

Share

Rate

You rated this post out of 5. Change rating