Home Forums SQL Server 2008 T-SQL (SS2K8) Restart runningtotal when predetermined value is reached RE: Restart runningtotal when predetermined value is reached

  • This process uses the 'Quirky Update' without the essential requirements being in place. As such it is unreliable & will almost certainly give incorrect results in the future (or may have already done so).

    Quirky Update is where variable & column are updated together:

    update #runTotal

    set @runningTotal = runningTotal = @runningtotal + FieldToSum

    See this:

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

    for more details - the list of requirements for Quirky Update are towards the end.

    It may seem a bit complicated - but unfortunately it is! 🙂