• Lynn Pettis (3/3/2009)


    Jeff Moden (3/3/2009)


    Lynn Pettis (3/3/2009)


    Oh, wow. Looks like I may have beat Jeff. But of course, he is probably setting up a million row example to demonstrate his code, where I just took what was presented and went from there. Jeff's code will also be heavily commented as well.

    Heh... you know me all to well, Brother Lynn! 😀 Although Mathew did a very good job of attaching sample data, the column names are quite a bit different than those posted and I also wanted to show a shorter way to post sample data. And, as you so very well put it, I was playing with my typical million row example and then saw you beat me to answering this. The only thing you forgot was the TABLOCKX to keep people out of the table while the update is occuring. 🙂

    If anyone wants to see the million row update to make a running total, you'll just have to wait until I can publish the rewritten article. :hehe:

    You can also find the same code in my article[/url], but it lacks all the detail behind it, as my work was based on Jeff's. (Sorry, shameless plugs.) :hehe:

    Shameless or not, it's a great article... people should go take a look!

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