Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
假设我有一个 TSQL 触发器
CREATE TRIGGER dbo.Trigger1 ON dbo.Table1 AFTER INSERT, UPDATE, DELETE
我如何知道上述哪一项操作(插入、更新或删除)导致触发器触发?
您可以检查inserted和deleted表的存在。
inserted
deleted
如果只inserted存在值 in ,则它是一个插入。如果仅deleted存在值,则为删除。如果两者兼而有之,那就是更新。