if exists(select [name] from sys.objects where [name]='触发器名称')
drop trigger 触发器名称
go
create trigger 触发器名称 on 表名
instead of update
as
if update(列名) ----------------这里只能写一个列名,怎么写多个列名??
begin
print '不能修改'
rollback
end
go
...全文
1105打赏收藏
instead of update触发器限制对列更新问题
if exists(select [name] from sys.objects where [name]='触发器名称') drop trigger 触发器名称 go create trigger 触发器名称 on 表名 instead of update as if update(列名) ----------------这里只能写一个列名,怎么写多个列名?? begin print '不能修改' rollback end go
这样也可以?
create trigger tguser on user_Info
instead of update as
if exists(select * from inserted as a inner join user_Info as b on a.u_id=b.u_id
where a.u_name != b.u_name or a.u_age != b.u_age)
begin
rollback
end
go