开发者

SQL triggers, invoke stored proc when an item is inserted/updated/deleted

开发者 https://www.devze.com 2023-03-31 11:59 出处:网络
I want to use triggers but is it possible to use a single trigger for insert/update/delete... I have done it for Delete. See below.

I want to use triggers but is it possible to use a single trigger for insert/update/delete... I have done it for Delete. See below.

ALTER TRIGGER [dbo].[CleanUpDate]
   ON   [dbo].[Marks]
   FOR DELETE
AS 
BEGIN
        DELETE FROM Grades
        FROM Grades
        JOIN deleted ON Grades.ID = 开发者_开发问答deleted.ID
END

Thanks


Yes, see the ALTER TRIGGER reference.

ALTER TRIGGER [dbo].[CleanUpDate]
   ON   [dbo].[Marks]
   FOR DELETE, UPDATE, INSERT
 AS 
 -- ...
0

精彩评论

暂无评论...
验证码 换一张
取 消