I am using Enterprise Manager for Sql Server 2000. In designing a foreign key relationship for a table, let's call it table A, I have more then one column acting as a foreign key for the same primary column in another table, let's call it table B. While I can specify for one of those foreign key columns in table A, which has the same column in another table as its primary key, to Cascade Deletes and Updates, successfully, when I try to also specify Cascade Delete and Updates for a second of my foreign key columns, which has the same column in another table as its primary key, I get an error saying that the second relationship with the Cascade "may cause cycles or multiple cascade paths."
I do not understand why this should be happening. If the Cascade is allowed for one of my columns, why does allowing it for more than one of my columns which point to the same primary key column cause this problem. Or is this just a bug in Sql Server 2000 which has been fixed in later releases of the product.No, it's not a bug, it's by design. If you want to create more than one cascade relationship between two tables, then there is only a way is to specify only first relationship as cascade and maintain other(s) via trigger(s).|||I do not understand the reasoning behind this design. I do not see how it matters if deleting a row in one table causes more than one row in another table to be deleted because of more than one cascade relationship between tables. Also the same situation for updated cascades should work properly also if there is more than one relationship between two tables. I can understand if the relationship goes both ways it could cause a recurring cycle, but if the relationship just goes one way it never can cause cascading problems AFAICS.
Friday, March 30, 2012
Relationships problem in Sql Server 2000
Labels:
call,
database,
designing,
enterprise,
foreign,
key,
manager,
microsoft,
mysql,
oracle,
relationship,
relationships,
server,
sql,
table
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment