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?
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With