日期:2014-05-18 浏览次数:20421 次
CREATE TRIGGER [NewArPay] ON [dbo].[Review] AFTER insert AS --SET NOCOUNT ON if @@rowcount = 0 --如果影响的行数为 0,则结束触发器运行,避免占用资源 return declare @name nvarchar(20) select @name = ResultStatus from inserted if @name = '批准' begin Insert into AR(DueDate,ProjectNO,ClientID,ClientName,Type,Cost,Remark) select enddate,ProjectNO,clientid,clientname,'管理费',cost ,'系统自动生成' from Project where status='申请中' and ProjectNO in (Select ProjectNO from Inserted ) end go
CREATE TRIGGER [NewArPay] ON [dbo].[Review] AFTER insert AS --SET NOCOUNT ON if @@rowcount = 0 --如果影响的行数为 0,则结束触发器运行,避免占用资源 return begin Insert into AR(DueDate,ProjectNO,ClientID,ClientName,Type,Cost,Remark) select enddate,ProjectNO,clientid,clientname,'管理费',cost ,'系统自动生成' from Project where status='申请中' and ProjectNO in (Select ProjectNO from Inserted WHERE ResultStatus='批准') end go