Several cascading actions
A series of cascading reference actions initiated by a single DELETE or UPDATE should form a tree that does not contain a circular Recommendation. A table cannot appear more than once in the list of all cascading reference actions that result from DELETE or UPDATE. In addition, the cascading referential tree should not have more than one path to any given table. Any tree branch is completed when it encounters a table for which NO ACTION is specified, or by default.
, , (, Active Deleted in Users). , .
ON DELETE SET NULL FK, FOR DELETE User :
CREATE TRIGGER Users_News_Delete_Trigger
ON Users FOR DELETE
AS BEGIN
UPDATE News SET createdById = NULL
WHERE createdById = DELETED.id;
UPDATE News SET updatedById = NULL
WHERE updatedById = DELETED.id;
END