• Ford Fairlane (1/19/2014)


    Thanks for the heads up Jeff, how would you tackle it then ?

    I use the Quirky Update method and will probably continue to do so even after my company upgrades to 2012 and then to 2014. It's not for the faint of heart and there are a shedload of rules to follow but, for the size of the tables I used it for, it was worth it. It'll do a running total on a million row table (comparatively small nowadays) in just a couple of seconds even if you use the more complicated version with built in "sort order verification".

    As an alternative, if the table that you need running totals for is a WORM table (write once, read many... like a check book where corrections are added in as additional transactions) AND you don't mind storing the running total, it might be better to use a trigger or some other code to calculate the running totals just for the new rows based on the previous maximum record.

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