日期:2014-05-18 浏览次数:20480 次
--方法1 FROM INSERTED T,MOCTE M,INVMC K inner join duizhuan N --改為 FROM INSERTED T Cross join MOCTE M Cross join INVMC K inner join duizhuan N
------解决方案--------------------
CREATE TRIGGER [dbo].[MOCTEQTYMO] ON [dbo].[MOCTE] AFTER INSERT,UPDATE,DELETE AS begin SET NOCOUNT ON UPDATE MOCTE SET UDF02=K.MC007,UDF04=N.OK FROM (select * from INSERTED T,MOCTE M,INVMC K WHERE T.TE001=M.TE001 AND T.TE002=M.TE002 AND T.TE003=M.TE003 AND T.TE004=K.MC001 AND T.TE008=K.MC002)T inner join duizhuan N on T.TE001=N.TE001 AND T.TE002=N.TE002 AND T.TE003=N.TE003 AND T.TE004=N.TE004 SET NOCOUNT Off end
------解决方案--------------------
改成如下试试看:
CREATE TRIGGER [dbo].[MOCTEQTYMO] ON [dbo].[MOCTE]
AFTER INSERT,UPDATE,DELETE AS
begin
SET NOCOUNT ON
UPDATE MOCTE
SET UDF02=K.MC007,UDF04=N.OK
FROM INSERTED T inner join duizhuan N on T.TE001=N.TE001 AND T.TE002=N.TE002 AND T.TE003=N.TE003 AND T.TE004=N.TE004,MOCTE M,INVMC K WHERE T.TE001=M.TE001 AND
T.TE002=M.TE002 AND
T.TE003=M.TE003 AND
T.TE004=K.MC001 AND
T.TE008=K.MC002
SET NOCOUNT Off
end