I am using SQL server 2000 and exec to send email.
I have a trigger which begins by checking the rowcount affected of the last executed statement. If it is 0, it is supposed to abort, however this didn't seem to be happening and when I introduced the next line shown which emailed me if rowcount was 0, I was suprised to find it fired every time even though from the way I read this, it wouldn't get to this line.
Why is it that two tests of ROWCOUNT following each other would produce different actions?
IF @@ROWCOUNT = 0 RETURN
if (@@ROWCOUNT = 0) exec master..xp_sendmail @recipients = 'email@example.com',@message = 'message',@subject = 'subject'