How do I get database space used

  • @anthony-2,

    Thanks for sharing that piece of code. I'll take a look

    Now, not trying to be a "pain in the butt" but how a cursor can be bad on my particular example, to iterate across databases?

    You are correct when saying that cursors should be the last option and avoid if possible, but I fail to identify performance issue if we use it here to get database names on a particular instance.

  • sql-lover (11/21/2012)


    @Anthony,

    Thanks for sharing that piece of code. I'll take a look

    Now, not trying to be a "pain in the butt" but how a cursor can be bad on my particular example, to iterate across databases?

    You are correct when saying that cursors should be the last option and avoid if possible, but I fail to identify performance issue if we use it here to get database names on a particular instance.

    From a performance standpoint, it's not in this case. But if you bought a child a piano, would you want them to practice hitting the right notes or the wrong ones?

    Practice makes perfect and this is just another opportunity to practice avoiding cursors. It trains the brain. 🙂

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

Viewing 2 posts - 16 through 16 (of 16 total)

You must be logged in to reply to this topic. Login to reply