Suggestions:
1. Include running totals utilizing the SQL 2012+ enhancements to the OVER clause (yes, the QU is still faster... but this is documented in BOL, and still beats everything else, including a cursor).
2. Include the ROW_NUMBER trick of having two ROW_NUMBER calculations (differing by the PARTITION BY clause) and subtracting these from each other to assign the same value to sequential rows.
If necessary, I can provide samples for both of these.
Also - check out the article from R. Barry Young from a few years ago on re-writing cursor code to be set-based.
If some other examples are provided, I could take this one on.
Wayne
Microsoft Certified Master: SQL Server 2008
Author - SQL Server T-SQL Recipes