USE [newSoc]
GO
/****** Object: Trigger [dbo].[reminder2] Script Date: 09/18/2013 09:42:42 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER TRIGGER [dbo].[reminder2]
ON [dbo].[要触发的表]
AFTER INSERT, UPDATE
AS
--InSert inserted、deleted 为固定的检测是否有插入
IF (EXISTS(SELECT TOP 1 ID from inserted) AND NOT EXISTS(SELECT TOP 1 ID from deleted))
BEGIN
insert into 状态表(*) select top 1 * from 触发表 inner join on
PRINT 1
END
--Modify inserted、deleted 为固定的检测是否有修改
IF (EXISTS(SELECT TOP 1 ID from inserted) AND EXISTS(SELECT TOP 1 ID from deleted))
BEGIN
insert into 状态表(*) select top 1 * from 触发表 inner join on PRINT 2
END