SQL Server trigger on insert,delete & update on table

后端 未结 2 1477
-上瘾入骨i
-上瘾入骨i 2020-12-31 16:28

I have a table Product and another table ProductLog.

The log table needs to track two columns in the Product table. Each time

2条回答
  •  渐次进展
    2020-12-31 17:19

    or just

    DECLARE @type CHAR(1)=
        case when not exists(SELECT * FROM inserted)
            then 'D'
        when exists(SELECT * FROM deleted)
            then 'U'
        else
            'I'
        end
    

提交回复
热议问题