• The Learner (12/13/2012)


    Of course - makes total sense! Thanks for the tip.

    I know it's an old post but you don't usually need to drop Temp Tables in a stored procedure. They usually clean themselves up.

    If your Temp DB is consuming a 200GB drive, you have a larger problem with some seriously bad code. Look for code with DISTINCT in it which is a "cover" for bad code that has accidental Cross Joins in them. Some call thes "Many-to-Many" joins and they're usually the result of a poorly designed database or someone writing criteria for code without a full understanding of what the data actually contains.

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