MSSQL判断触发器事件类型【转】
IF EXISTS (
SELECT
1
FROM
INSERTED )
AND
NOT
EXISTS (
SELECT
1
FROM
DELETED)
-- 插入
BEGIN
...
END
ELSE
IF EXISTS (
SELECT
1
FROM
INSERTED )
AND
EXISTS (
SELECT
1
FROM
DELETED)
-- 更新
BEGIN
...
END
ELSE
IF
NOT
EXISTS (
SELECT
1
FROM
INSERTED )
AND
EXISTS (
SELECT
1
FROM
DELETED)
-- 删除
BEGIN
...
END
Believe you are strong,and to be stronger.