• tamirgerber - Wednesday, February 20, 2019 2:05 AM

    Jeff Moden - Tuesday, February 19, 2019 9:58 PM

    tamirgerber - Tuesday, February 19, 2019 6:51 PM

    One could use sp_msForEachDB builtin stored procedure. No cursor, no loop, and less chance to get into security issues.

    Not quite right.  If you look at the actual code sp_msForEachDB and the procedure that calls, its a cursor/loop on steroids. 😉

    I am sorry for not being clear enough. My idea was that call of sp_msForEachDB eliminates a need to use cursor and loop explicitly. Less custom code - less headache 🙂

    Ah.  Got it.  Thanks for the feedback.

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