[dba-SQLServer]Roles and Rules etc.

Djabarov, Robert Robert.Djabarov at usaa.com
Tue Aug 19 11:52:47 CDT 2003


Having rules and CHECK constraints may be an overkill and somewhat
cumbursome to maintain.  I would stick to one or the other.  There's
still a benefit of using rules because a rule can be bound to columns in
different tables, while CHECK constraint will have to be re-created for
each table and can be bound to multiple columns within a table.  Another
advantage is that you can bind a rule to a user-defined datatype which
will be implicitly used wherever you use this datatype.  Mind you though
that it may be very hard to debug!  Disadvantages of using rules are:
(1) each column/datatype can have only one rule bound to it at a time;
(2) If a rule is bound to more than one column (and even worse - more
than 1 datatype) even existence of documentation on that would not ease
the potential maintenance nightmare.

I have to work with a lot of code that came all the way from 4.2a on
OS/2, so I see rules all over the place and have internal usage diagrams
and matrices that define each rule and its usage.  Nightmare?  Hell
yeah!  But some view it as job security :)

What's BCNF?

-----Original Message-----
From: Arthur Fuller [mailto:artful at rogers.com] 
Sent: Tuesday, August 19, 2003 11:24 AM
To: dba-sqlserver at databaseadvisors.com
Subject: RE: [dba-SQLServer]Roles and Rules etc.


1. So does that mean, forget about them and use check constraints
exclusively? 2. Can a check constraint apply to multiple columns? Or is
that by definition a failure to go to BCNF?

A.

-----Original Message-----
From: dba-sqlserver-bounces at databaseadvisors.com
[mailto:dba-sqlserver-bounces at databaseadvisors.com]On Behalf Of
Djabarov, Robert
Sent: Tuesday, August 19, 2003 11:36 AM
To: dba-sqlserver at databaseadvisors.com
Subject: RE: [dba-SQLServer]Roles and Rules etc.


Rule doesn't have anything to do with roles and permissions.  It's
similar however to CHECK constraint.
BOL:
"Rules, a backward compatibility feature, perform some of the same
functions as check constraints. CHECK constraints, created using the
CHECK keyword of ALTER or CREATE TABLE, are the preferred, standard way
to restrict the values in a column (multiple constraints can be defined
on one or multiple columns)."

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.510 / Virus Database: 307 - Release Date: 8/14/2003

_______________________________________________
dba-SQLServer mailing list
dba-SQLServer at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/dba-sqlserver
http://www.databaseadvisors.com



More information about the dba-SQLServer mailing list