Create trigger trigger_name
on TB_SGJH for update
as
begin
update TB_SGJH set OpNum = OpNum+1,OpDate=getdate() where JH_ID = (select JH_ID from inserted)
end
转载于:https://www.cnblogs.com/mingjing/p/5752974.html
本文介绍了一个SQL触发器的应用实例,当某表中记录被更新时,该触发器会自动修改同一个表中的两个不同字段。具体实现方式为:每当特定字段发生变化,触发器将更新同一记录中的操作次数并设置当前日期。
Create trigger trigger_name
on TB_SGJH for update
as
begin
update TB_SGJH set OpNum = OpNum+1,OpDate=getdate() where JH_ID = (select JH_ID from inserted)
end
转载于:https://www.cnblogs.com/mingjing/p/5752974.html
1224

被折叠的 条评论
为什么被折叠?