触发器 如何判断是 插入触发的,还是更新触发的

if exists (select 1 from inserted) and not exists (select 1 from deleted)
    --insert

if exists (select 1 from inserted) and exists (select 1 from deleted)
    --update

if not exists (select 1 from inserted) and exists (select 1 from deleted)
    --delete

posted on 2009-07-23 17:58  martian6125  阅读(328)  评论(0编辑  收藏  举报