Tuesday, June 12, 2007

How to find out if a trigger was fired by a delete transaction?
A popular method is to compare the counts of the inserted and deleted virtual tables to see if they match. Here is a simpler method: use the Columns_Updated function. When a trigger is fired by a delete transaction, Columns_Updated() always returns the varbinary value 0x. The following check will verify that the trigger was fired by a delete:
If Columns_Updated() = 0x