Answers for "how to add on delete cascade to a foreign key constraint in sql server"

2

add on delete cascade to existing foreign key

ALTER TABLE TABLEName
drop CONSTRAINT FK_CONSTRAINTNAME;

ALTER TABLE TABLENAME
ADD CONSTRAINT FK_CONSTRAINTNAME
    FOREIGN KEY (FId)
    REFERENCES OTHERTABLE
        (Id)
    ON DELETE CASCADE ON UPDATE NO ACTION;
Posted by: Guest on July-16-2021

Code answers related to "how to add on delete cascade to a foreign key constraint in sql server"

Browse Popular Code Answers by Language