I have a problem where i need a cascade on multiple foreign keys pointing to the same table..
[Insights]
| ID | Title |
| 1 | Monty Python |
| 2 | Spamalot |
[BroaderInsights_Insights]
| broaderinsight_id | insight_id |
| 1 | 2 |
Basically when either record one or two in the insights table is deleted i need the relationship to also be deleted..
I've tried this:
CREATE TABLE broader_insights_insights(id INT NOT NULL IDENTITY(1,1),
broader_insight_id INT NOT NULL REFERENCES insights(id) ON DELETE CASCADE,
insight_id INT NOT NULL REFERENCES insights(id) ON DELETE CASCADE,
PRIMARY KEY(id))
Go
This results in the warning that the cascade "may cause cycles or
multiple cascade path"
So ive tried adding a cascade to just the insight_id and this results in:
The DELETE statement conflicted with the REFERENCE constraint
Any ideas?
Thanks
Daniel
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…