触发器中如何判断触发操作是insert update delete
在create trigger trigger_name for insert,update,delete中
可以利用
if(select count(*) from inserted > 0 and select count(*) from deleted > 0)
来判断update
if(select count(*) from inserted > 0 and select count(*) from deleted =0)
来判断insert
else为删除。
除了这种方法有没有更简单些的方法呢?
------解决方案--------------------create trigger trigger_name_i for insert
create trigger trigger_name_u for update
create trigger trigger_name_d for delete
------解决方案--------------------够快
------解决方案--------------------不要给他编了,没代码最整洁