日期:2014-05-18 浏览次数:20513 次
CREATE trigger [FC_RK_CLXX_T_update] on [dbo].[FC_RK_CLXX_T] instead of update as begin if update(FC_CL_ID) or update(DJ) begin Update FC_CL_QCKC_T Set FC_CL_ID=i.FC_CL_ID,DJ=i.DJ From FC_CL_QCKC_T br , Deleted d ,Inserted i Where br.FC_RKJL_ID=i.ID end end
CREATE trigger [FC_RK_CLXX_T_update] on [dbo].[FC_RK_CLXX_T] instead of update as begin if update(FC_CL_ID) or update(DJ) begin Update FC_CL_QCKC_T Set FC_CL_ID=i.FC_CL_ID,DJ=i.DJ From FC_CL_QCKC_T br , Deleted d ,Inserted i Where br.FC_RKJL_ID=i.ID end if update(SFSH) begin Update FC_CL_QCKC_T Set SFSH=i.SFSH From FC_CL_QCKC_T br , Inserted i Where br.FC_RKJL_ID=i.ID end end
------解决方案--------------------
--這樣建,主鍵換成你的主鍵關聯就可以了 CREATE trigger [FC_RK_CLXX_T_update] on [dbo].[FC_RK_CLXX_T] instead of update as begin if update(FC_CL_ID) or update(DJ) begin Update FC_CL_QCKC_T Set FC_CL_ID=i.FC_CL_ID,DJ=i.DJ From FC_CL_QCKC_T br , Deleted d ,Inserted i Where br.FC_RKJL_ID=i.ID end if update(SFSH) update FC_RK_CLXX_T set SFSH=i.SFSH from inserted i where i.主鍵=FC_RK_CLXX_T.主鍵 end