开发者

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

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜