想写一个修改触发器。。。请各位大神帮帮我
CREATE TRIGGER [JU_Uint_People_XueliAndZhichengUpdate] ON [dbo].[JU_Unit_People]
FOR UPDATE
AS
IF UPDATE(xueli)
begin
INSERT INTO JU_People_Record(ysxl,id_rl) values(Deleted.xueli,Deleted.id_rl)
end
IF UPDATE(ZhiCheng)
begin
INSERT INTO JU_People_Record(yszc,id_rl) values(Deleted.ZhiCheng,Deleted.id_rl)
end
这是代码 想实现的是 当JU_Unit_People的 xueli和 ZhiCheng字段发生修改时触发 但是提示我这里不能用列名。。触发器真不懂 请大神们帮帮我
[解决办法]
CREATE TRIGGER [JU_Uint_People_XueliAndZhichengUpdate] ON [dbo].[JU_Unit_People]
FOR UPDATE
AS
IF UPDATE(xueli)
begin
INSERT INTO JU_People_Record(ysxl,id_rl) select xueli,id_rl from Deleted
end
IF UPDATE(ZhiCheng)
begin
INSERT INTO JU_People_Record(yszc,id_rl) select ZhiCheng,id_rl from Deleted
end