--触发器示例create trigger tri_update --创建触发器 'tri_update'(触发器名称) on Tab --创建触发器的对象 (表 'Tab') for update --触发的动作 (update) as if update(ID) --触发事务(更新ID的话触发执行) begin raiserror('NO!',3,3) --触发后执行 rollback tran --回滚 end go
如果是05以及已上版本 update output 语句 自己搜一下。 2000 用触发器。
select * into A fram B where a.x<>b.x
--触发器示例create trigger tri_update --创建触发器 'tri_update'(触发器名称) on Tab --创建触发器的对象 (表 'Tab') for update --触发的动作 (update) as if update(ID) --触发事务(更新ID的话触发执行) begin raiserror('NO!',3,3) --触发后执行 rollback tran --回滚 end go
on Tab --创建触发器的对象 (表 'Tab')
for update --触发的动作 (update)
as
if update(ID) --触发事务(更新ID的话触发执行)
begin
raiserror('NO!',3,3) --触发后执行
rollback tran --回滚
end
go
2000 用触发器。
where a.x<>b.x
on Tab --创建触发器的对象 (表 'Tab')
for update --触发的动作 (update)
as
if update(ID) --触发事务(更新ID的话触发执行)
begin
raiserror('NO!',3,3) --触发后执行
rollback tran --回滚
end
go