I was trying to create
a table
via SSMS 11.0.6020.0 using SQL Server, via the table
designer. I have defined the primary key
, the column
s and foreign key
s. All was well, but when I have hit Ctrl+s to save the script, I received an error message stating that On Delete Cascade
may cause cycles and change the remove behavior. I have followed the instructions given and changed the on delete
and on update
to do nothing
for the nullable
column
used as foreign key
, but I wonder what is the problem with on delete cascade
and on update cascade
for nullable
foreign key
.
My question is related to this one, but as far as I know it is not a duplicate, since I have a single reference to a given table
and the problem was that it was nullable
and the other question is about multiple references. The error message is similar though.
I believe that if that column
is null
for a record, then it does not have a reference in the referenced table
, therefore there is no reference which could trigger delete
/update
on that record. However, if there is a reference, that could act as if the column
was not nullable
in that case. Is there an objective reason for this behavior (like performance, indexing, etc.)? I can simply not see the possible cycles when a nullable
column
is used as a foreign key
, as the null
values should be immune to changes at the reference table according to my opinion.