Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Declarative RI....
Message
From
15/05/2003 10:22:56
 
 
To
10/05/2003 12:32:57
General information
Forum:
Microsoft SQL Server
Category:
Other
Miscellaneous
Thread ID:
00786627
Message ID:
00788703
Views:
15
Correct, if you have both a trigger and a FK, the trigger will not fire if you get a FK violation. In this case, you would create only a trigger.

Roman


>Ok,
>
>But, if you change a PK, that is related to other tables, isn't the trigger fired after the update there by violating the FK rules on the child table causing the update to fail? I know you use to have to use triggers for cascades so there must be some way around this.
>
>Thanks for the info,
>BOb
>
>
>>The ANSI SQL-92 standard defines a rule that you can't have two paths to the same row in the referencing table resulting from an action in the parent table.
>>
>>This is from BOL:
>>
>>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.
>>
>>Looks like you'll have to use triggers, at least on the second column.
>>
>>Roman
>>
>>
>>>Can anyone point to the reason you can't do a cascade delete when there are two FK's to the same field in a table?
>>>
>>>For example...
>>>
>>>city has a pk of city_pk
>>>
>>>
>>>And employee has two fk,s
>>>
>>>homecityfk and workcityfk ... both relate to city_pk. I can create the FK constraints, but when I tell it to cascade key updates to more than one FK I am told it 'might be cylic' which it doesn't seem like it will.
>>>
>>>does anyone know a work around (other than a trigger) for this situation, or can point me to a BOL topic on why you can't do this?
>>>
>>>Thanks,
>>>BOb
Roman Rehak, MCSD, MCDBA, MCSA
Competitive Computing
354 Mountain View Drive
Colchester, VT 05446-5824
802-764-1729
Previous
Reply
Map
View

Click here to load this message in the networking platform