I have three tables in my database: Events, Jobs, and CollectableEntities.
Events has a nullable FK pointing to Jobs' PK.
Events and Jobs both have non-nullable FKs (that are also those table's PKs) pointing to CollectableEntities' PK. These FK relationships are set to cascade on update and delete. Basically, when you delete a CollectableEntity, I want the associated Event and/or Job to be deleted also.
I am now trying to change the Events to Jobs FK relationship to set null on update or delete, but I get the following error:
Error SQL01268: .Net SqlClient Data Provider: Msg 1785, Level 16, State 0, Line 1 Introducing FOREIGN KEY constraint 'FK_Events_Jobs' on table 'Events' may cause cycles or multiple cascade paths. Specify ON DELETE NO ACTION or ON UPDATE NO ACTION, or modify other FOREIGN KEY constraints.
Where is the cycle? How can I avoid this problem given that the description above is the only effects I want. (I'm willing to make changes to avoid other unforeseen side-effects.)