请看看这个sql server 触发器哪里有问题?

--这个不成功
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

update ICStockBillEntry set FEntrySelfD0143 =(select datediff(day,FEntrySelfD0141,FEntrySelfD0142) FROM ICStockBillEntry where FInterID=@D) where FInterID=@D
你可以单独测试一下这个语句啊

您好,我是有问必答小助手,您的问题已经有小伙伴帮您解答,感谢您对有问必答的支持与关注!
PS:问答VIP年卡 【限时加赠:IT技术图书免费领】,了解详情>>> https://vip.csdn.net/askvip?utm_source=1146287632