• twin.devil (12/13/2013)


    if there is large data set in the #Temp table, all you find in the query execution plan is "tableScan" for #Temp table, If you need to increase the performance then you need to index the temp table as well.

    Maybe not. It the only things in the Temp Table are things that are actually needed, the scan of a heap can frequently be faster than adding and using an index. In the name of "It Depends", it is worth a test, though.

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