• Got an initial working resolution. Some guy by the name of Jeff 😀 has an article: Solving the Running Total and Ordinal Rank Problems (Rewritten)http://www.sqlservercentral.com/articles/T-SQL/68467/

    Thanks Jeff!

    I used the "Quirky Update" and got:

    DECLARE @PrevAccountID VARCHAR(10)

    DECLARE @AccountRunningTotal BIGINT = 0

    UPDATE #tmp_details

    SET @AccountRunningTotal = RankTick = CASE

    WHEN RefNum = @PrevAccountID THEN @AccountRunningTotal

    ELSE @AccountRunningTotal + 1

    END,

    @PrevAccountID = RefNum

    FROM #tmp_details WITH (TABLOCKX)

    OPTION (MAXDOP 1)which gave me what I was looking for using the test data. Now to try it on the actual data.

    Thanks g.britton for your help. You got me thinking about other similar code (i.e. running total).