The linked duplicate above didn't solve the problem. They only talked on possibilities that they have to resolve.
I need to delete an item on cascade on same table, so I have:
CREATE TABLE Person
(
id int primary key identity,
name varchar(30) not null,
idFather int
CONSTRAINT fkIdFather FOREIGN KEY (idFather) REFERENCES Person(id) ON DELETE CASCADE
)
I have this like result of a select
:
So, when I delete Jon: Robert, Alex and Jeff need to be deleted too.
When I delete Alice: Jon, Robert, Alex and Jeff need to be deleted too.
When I did this, i got this error:
Introducing FOREIGN KEY constraint 'fkIdFather' on table 'Person' may cause cycles or multiple cascade paths. Specify ON DELETE NO ACTION or ON UPDATE NO ACTION, or modify other FOREIGN KEY constraints.
Could not create constraint. See previous errors.
How can I resolve this?