• wardster (8/21/2010)


    In Mel's example in the original article, he deletes from his staging table after committing the transaction which inserts into the target table and updates the source table, and even explicitly comments the fact to stress it's importance:

    --Don't delete from temp table until transaction is committed

    DELETE @TempSource

    Does this matter?

    With a table variable, no. It's not affected by transactions. But, if you look at the comment, it looks like the author may have used a Temp Table originally and changed it to a table variable later on. It could matter if it's a Temp Table (although I've not studied the code well enough to know for sure in this case).

    --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)