I have the table with one primary key
and one foreign key
referencing the same table primary key
.
i.e there are parents and childs in the same table. In sql sever there are three options for the delete rule. But it is only possible to set "NO ACTION"
delete rule. I understand that it is not possible to set the "cascade" delete
because of cycles and chaining. But why the other options are not allowed? Especially the "SET NULL"
one.
Right now I have to do this manually. I have to find the child records and set the foreign key on null. After that I can delete the parent. Why is it not possible to set the rule for it?