• Another problem with doing it using a permanent table, whether in TempDB or some other database, is the chance of a naming conflict. You could go through some gyrations to resolve such conflicts by including a DATETIME stamp in the name of the table, but I think it might be easier just to populate a single permanent table and delete only those rows that are no longer necessary using a "BatchID" or other form of row identification.

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