• Steve Smith-163358 (10/2/2013)


    It appears to me that the Drop Table command has a higher overhead than looping through the cursor.

    Therefore the performance isn't particularly different whether I run through a cursor or not.

    That's absolutely correct. In fact, this is what cursors were originally designed for... process control. Cursors got a really bad name simply because people took to using them for the wrong things.

    Still, I avoid even "process control" cursors like this, especially since the advent of the MAX datatypes in 2005. I've gotten so used to using the methods similar to the code that Alan posted that I'd have to lookup how to write a cursor and use it. 🙂

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