时间:2021-07-01 10:21:17 帮助过:16人阅读
方法1:
create trigger user_delete ——针对哪一个表的哪一个动作
on users ——针对哪一个表的触发器
for delete ——针对哪一个动作之后的触发器
as
select * from users ——针对哪一个动作之后执行替换
方法2:
create trigger users1_delete
on users
instead of delete
as
select * from users
select * from deleted
declare @a nvarchar(10);
select @a=ids from deleted;
if @a>5
begin
select ‘太丑了,删不了‘
end
else
begin
delete from users where ids=@a
end
SQL server ——触发器
标签:begin bsp ash tab trigger server style end ted