sql server update触发器

--判断名称是否已存在,不建议,万一删了别人创建的呢
if (object_id('tgr_classes_update', 'TR') is not null)
    drop trigger tgr_classes_update

--查询看是否存在
select object_id('tgr_classes_update', 'TR');

--创建update触发器
create trigger tgr_classes_update
on classes
    for update
as
    declare @oldName varchar(20), @newName varchar(20);
    --更新前的数据
    select @oldName = name from deleted;
    --更新后的数据
    select @newName = name from inserted;
    
go

参考:https://www.cnblogs.com/Brambling/p/6741666.html

https://www.cnblogs.com/hoojo/archive/2011/07/20/2111316.html

触发器中获取客户端ip和名称 https://blog.csdn.net/ksrsoft/article/details/8457195

原文地址:https://www.cnblogs.com/fangxinliu/p/13503115.html