WiRL (2/27/2013)
Awesome that works.Many Thanks
Actually, it doesn't. If you insert more than one rrow into the table that fires the trigger, the trigger will only process one row. You need to rewrite the code in a set based fashion to get all of the rows. Please see Books Online (press the {f1} key) and read up on the INSERTED and DELETED logical tables that are available when the trigger is doing its job.
It's also a pretty bad idea to call email in a trigger. If email is down, the trigger could fail which will rollback the external transaction. It's a far bettter thing to insert what you want into a staging table and have a job sweep through that tablee to send the emails.
--Jeff Moden
Change is inevitable... Change for the better is not.