• 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


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)