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: 63 | Views in the last 30 days: 3

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: 63 | Views in the last 30 days: 3
Your response
 
 
Related Articles
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.

FORUM

Modify Check constraint

Modify Check constraint

FORUM

WHY CHECK CONSTRAINT IS NOT WORKING

WHY CHECK CONSTRAINT IS NOT WORKING

ARTICLE

Using Check Constraints

Check constraints can be added to a table to enforce specific rules on one or more columns. This art...

Tags
database weekly    
editorial    
 
Contribute

Free registration required...

To read the rest of this article, and access thousands of other articles, we ask you to register on the site and subscribe to our newsletters.

Login (existing users)

Login

Email:   Password:   Remember me: Forgotten your password?

Register (new users)

Register

Email:   Password:
Confirm:

Subscribing to our newsletters gets you:

  • ALL of our content (thousands of articles, scripts, and forum postings)
  • A daily newsletter (example)
  • A weekly news round up (example)
  • The opportunity to ask and answer questions in our forums
  • A daily Question of the Day to test and help you increase your knowledge of SQL Server.

Steve Jones
Editor, SQLServerCentral.com