In SQL Server 2000, by default, does a DELETE query cause a table's UPDATE trigger to be executed?
I know I can define a trigger that will be executed on both DELETE and UPDATE, but I thought I would verify that this is in fact required first.
In SQL Server 2000, by default, does a DELETE query cause a table's UPDATE trigger to be executed?
I know I can define a trigger that will be executed on both DELETE and UPDATE, but I thought I would verify that this is in fact required first.
dump this in your trigger and check for yourself
IF @@ROWCOUNT > 0
BEGIN
IF EXISTS (SELECT 1 FROM inserted)
BEGIN
IF EXISTS (SELECT 1 FROM deleted)
PRINT 'update';
ELSE
PRINT 'insert';
END
ELSE
PRINT 'delete';
END
A DELETE does not fire UPDATE triggers. If you have a trigger defined to be fired on DELETE and also on UPDATE then it will be executed on a DELETE but that's because it's also a DELETE trigger.