What is the reason for this error?
Msg 2113, Level 16, State 1, Procedure DISTRACTPERMIT, Line 1 [Batch Start Line 4]
Cannot create INSTEAD OF DELETE or INSTEAD OF UPDATE TRIGGER 'DISTRACTPERMIT' on table 'dbo.USER_PEMITION'. This is because the table has a FOREIGN KEY with cascading DELETE or UPDATE.
Amit MohantyPosted Jul 25, 2022, 9:47 AM
This is because the table has a FOREIGN KEY with cascading DELETE or UPDATE.
DELETE CASCADE: When we create a foreign key using this option, it deletes the referencing rows in the child table when the referenced row is deleted in the parent table which has a primary key.
UPDATE CASCADE: When we create a foreign key using UPDATE CASCADE the referencing rows are updated in the child table when the referenced row is updated in the parent table which has a primary key.
for more details check below link
https://www.sqlshack.com/delete-cascade-and-update-cascade-in-sql-server-foreign-key/
Daanish GPosted Jul 25, 2022, 2:18 PM
Thanks bro