Reputation: 337
If I create a database trigger in SQL Server 2008 which triggers on both DROP_TABLE and ALTER_TABLE, how do I determine whether this is a DROP or an ALTER?
Upvotes: 3
Views: 92
Reputation: 453298
Inside the trigger you can test
SELECT EVENTDATA().value('(/EVENT_INSTANCE/EventType)[1]','sysname')
It will be DROP_TABLE
or ALTER_TABLE
Documentation for EVENTDATA
Upvotes: 5