1. 程式人生 > >單個觸發器判斷Insert/Delete/Update操

單個觸發器判斷Insert/Delete/Update操

ALTER TRIGGER [triger_Video]   ON [dbo].[tb_Video]   FOR INSERT,DELETE,UPDATE   AS BEGIN   IF EXISTS(SELECT 1 FROM deleted) AND EXISTS(SELECT 1 FROM inserted)   BEGIN   UPDATE sqlstatement   END   ELSE IF EXISTS(SELECT 1 FROM inserted)    BEGIN   INSERT sqlstatement   END     ELSE   BEGIN   DELETE sqlstatement
  END END