Lynn Pettis (9/5/2008)
I must not fully understand INSERT triggers, but I was always under the impression that if nothing was inserted, an insert trigger WON'T fire. I have never had to write an insert trigger to handle a zero row insert; multi-row inserts, yes. I guess this is something I am going to have to investigate.😎
As others have already poitned out, the trigger stil fires even if no rows are affected. That's why many developers make it a habit to start each trigger with this line:
IF @@ROWCOUNT = 0 RETURN;
Do make sure that it's the very first line of the trigger, though. I once have spent way too long staring at mysterious results until I realised that I had put this statement after the SET NOCOUNT ON, so I checked the @@ROWCOUNT from that SET statement (which is always 1). :Whistling: