August 16, 2005 at 7:30 pm
noel - since you know all about linked servers - could you please help Bryan out if you have the time ?!
**ASCII stupid question, get a stupid ANSI !!!**
August 16, 2005 at 7:34 pm
SUSHILA!!!
What are you doing in SSC at these hours?
* Noel
August 16, 2005 at 7:38 pm
looking for words of wisdom from the gurus...sometimes i'm online round the clock -
**ASCII stupid question, get a stupid ANSI !!!**
August 16, 2005 at 7:41 pm
I would think that at these times you will probably be the only guru around
* Noel
August 16, 2005 at 7:43 pm
we have a saying in india which roughly translates to - "in the land of the blind, the one-eyed man is king"....
**ASCII stupid question, get a stupid ANSI !!!**
August 16, 2005 at 7:46 pm
I really admire your consistency and modesty!
I have seen very good suggestions coming from you and I am not afraid to tell you
* Noel
August 17, 2005 at 8:46 am
Thanks guys! I'm trying to understand this issue. It didn't take me long to understand what was meant by circular references. However, I didn't see what was wrong with it. I thought "That's what i want!" So how do i fix it and maintain the integrity of my data?
Here is some information i found.
Multiple Cascading Actions
The series of cascading referential actions triggered by a single DELETE or UPDATE must form a tree containing no circular references. No table can appear more than once in the list of all cascading referential actions that result from the DELETE or UPDATE. The tree of cascading referential actions must not have more than one path to any given table. Any branch of the tree is terminated when it encounters a table for which NO ACTION has been specified or is the default.
You can enforce referential integrity in several ways. Declarative Referential Integrity (DRI) is the most basic way, but it is also the least flexible way. If you need more flexibility, but you still want a high degree of integrity, you can use triggers instead.
August 17, 2005 at 8:51 am
I don't know. For some reason, i had the impression that you had left but that you would answer when got back in. Then to see this comment, i thought that's funny! Thanks a great deal!
August 17, 2005 at 9:41 am
Not that you guys like my book MS SQL Server2000 Bible, but it makes it sound as if DRI using Cascade Deletes are preferable.
p 320 says: "Implementing cascade deletes manually is a lot of work. Because foreign-key constraints are checked before triggers, cascade-delete triggers don't work with SQL Server DRI via foreign keys. Therefore, not only will triggers have to handle the cascading delete, but they will have to perform RI checks as well."
p 133 says: "SQL Server's DRI can be enforce referential integrity without writing custom triggers or code." It next explains that DRI executes faster than custom RI triggers.
When mentioning CAUTIONS about cascading deletes, it doesn't mention anything about circular references.
August 17, 2005 at 9:59 am
Well it IS!! -- from performance stand point
The problem comes when you give someone the power to delete all child records from all cascaded tables which some times can wipe out the whole thing with a simple Delete * from OneSingleTable
If you gurrantie that only access to that table is through SPs and that only one SP can do that and that only VERY limitted number of users (preferably only ONE) has such power then I see no reason not to use it. I have in the past but took all those meassures before
Cheers!
* Noel
August 17, 2005 at 10:15 am
To me that is just a matter of permissions not ability. Though i don't want to delete all the tests now, i would prefer to make them inactive, but years down the line, i would want the ability to delete TestID=1 if it is no longer in use.
The only way to do this seems to be through triggers. You guys have mentioned SPs. But do you mean queries that contain SQL statements? Well, i guess a trigger is a SP, but what exactly do you mean? Trigger or SP? Or it doesn't matter?
In this DB, I'm considering removing cascade deletes all together. At least via DRI. Is that a good idea? This reminds me of a statement Remi made.
I'm already using an alternative via an inactive column in quite a few of my tables.
Thanks!
August 17, 2005 at 10:41 am
With stored procedures you code manually the deletes starting from the lowest in the hierarchy! with triggers you could do the same thing but Triggers are more difficult to debug maintain and tend to generate "unexpected" issues that are associated with rollbacks on them.
It is cleaner to use stored procedures but is not as self maintained as it seems to be with triggers.
Just my $0.02
* Noel
Viewing 12 posts - 16 through 26 (of 26 total)
You must be logged in to reply to this topic. Login to reply