• a4apple (1/17/2014)


    refer to this post...

    http://sqlsaga.com/sql-server/how-to-calculate-running-totals-in-sql-server/[/url]

    step by step explained...

    Same thing there. It's a Triangular Join. No matter what, it will always use more resources than you could possibly imagine. In pre-2012 SQL Server, it's far better to learn how to use a "Quirky Update" correctly. If you take exception to that unsupported method, then write a Cursor or While loop to do the running total. See the following URL for more on the problems with Triangular Joins.

    http://www.sqlservercentral.com/articles/T-SQL/61539/

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