--这个不成功
create trigger datepq
on ICStockBillEntry
after update
as
begin
declare @D INT;
SELECT @D=FInterID FROM ICStockBillEntry
/更新运输天数/
/insert into ICStockBillEntry (FEntrySelfD0143) select datediff(day,FEntrySelfD0141,FEntrySelfD0142) FROM ICStockBillEntry where FEntrySelfD0129=@D0129/
update ICStockBillEntry set FEntrySelfD0143 =(select datediff(day,FEntrySelfD0141,FEntrySelfD0142) FROM ICStockBillEntry where FInterID=@D) where FInterID=@D
end
go
--这个成功
create trigger table_t2
on table_2
after update
as
begin
declare @D int;
select @D=ID FROM TABLE_2
/更新运输天数/
/insert into ICStockBillEntry (FEntrySelfD0143) select datediff(day,FEntrySelfD0141,FEntrySelfD0142) FROM ICStockBillEntry where FEntrySelfD0129=@D0129/
update table_2 set day =(select datediff(day,ent1,ent2) FROM table_2 where ID=@D) where ID=@D
end
go