Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 Database Design and Application Architecture
 Cascading Delete permitted, but not Update??

Author  Topic 

mattyboy1999
Starting Member

2 Posts

Posted - 2009-01-21 : 17:48:18
Hi all

This is my first post on this forum, so please be nice

I'm having trouble defining a relationship in a database on which I'm working. I'm implementing cascading deletes and updates (CD and CU), but I have a situation where the r/ship permits CD but will NOT allow CU. I get this error message:

- Unable to create relationship XXX
Introducing FOREIGN KEY constraint 'XXX' on table 'X' may cause cycles or multiple cascade paths. Specify ON DELETE NO ACTION or ON UPDATE NO ACTION, or modify other FOREIGN KEY constraints.
Could not create constraint. See previous errors.

The "target" table, i.e. the table on the "Many" side of the 1-to-M r/ship, has a primary key comprising 3 fields, not just 1. I have two 1-to-M r/ships into this table, one is performing a cascading delete AND update for just ONE of the fields involved in this primary key. I want my other relationship, from another table, to perform the cascading delete and update for the other TWO fields.

In the diagram below, ID field from table X has CD and CU set up, that's all fine. ID fields from table Z (BOTH Fields, that is to say, ID and Version) need to have CD and CU set up.

I don't understand why SQL server would allow CD but not allow CU in this case.

Any and all feedback greatly appreciated. Thanks.



mattyboy1999
Starting Member

2 Posts

Posted - 2009-01-26 : 16:32:46
Doesn't matter... I've persuaded my management to forego using Cascading Updates (at least for now)... I didn't think they were a good idea anyway.
Go to Top of Page
   

- Advertisement -