SQL server触发器在触发前的问题
发布网友
发布时间:2022-04-27 02:22
我来回答
共3个回答
热心网友
时间:2022-04-11 17:40
create trigger tri_deleteLevel on users
instead of delete
as
declare @v_usid int
select @v_usid=usid from deleted
delete level_assign where usid=@v_usid
/*
上面触发器在删除users表内容前引发,但相应的操作并不被执行(就是说users表的内容不会删除),而运行的仅是触发器SQL 语句本身,deleted和inserted都有响应*/
热心网友
时间:2022-04-11 18:58
create trigger tri_deleteLevel on users
for BEFORE delete as
declare @v_usid int
select @v_usid=usid from deleted
delete level_assign where usid=@v_usid
这样试试