create TRIGGER testtrigger --触发器名称
on tb --表名
after update --更新触发
as
if update (column1) --当column1字段被更新时,才会触发此触发器
BEGIN
SET NOCOUNT ON;
DECLARE @a VARCHAR (20) --定义变量
SET @a = (SELECT d.ida
FROM
deleted d,
inserted i
WHERE
d.ida = i.ida
) --变量赋值 ,找到对应更新的那一行。
update tb set test = 'g2' where ida = @a --执行的操作
end
create TRIGGER [dbo].[billtrigger]
on [dbo].[ICStockBill]
after update --更新触发
as
if update (FStatus) --当FStatus字段被更新时,才会触发此触发器
BEGIN
SET NOCOUNT ON;
DECLARE @a VARCHAR (20) --定义变量
SET @a = (SELECT
d.FInterID
FROM
deleted d,
inserted i
WHERE
d.FInterID = i.FInterID
) --变量赋值 ,找到对应更新的那一行。
update ICStockBillEntry set FEntrySelfB0457 =
(select b.FQty from ICInventory b
where ICStockBillEntry.FItemID = b.FItemID
and ICStockBillEntry.FSCStockID=b.FStockID)
where finterid =@a
end
alter TRIGGER testtrigger --触发器名称 on tb --表名 after update --更新触发 as if update (column1) --当column1字段被更新时,才会触发此触发器BEGIN SET NOCOUNT ON; DECLARE @a VARCHAR (20) --定义变量 SET @a = (SELECT d.ida FROM deleted d, inser...