If there are only a few hundreds (or few thousands?) of rows, and if the calculations need to be done only infrequently, I guess it wouldn't matter. But the increase in resources and computation is O(2) or nearly so, which means that for most other scenarios, the approach shown above probably would not be suitable.Other approaches I can think of (other than doing it on the client - which I am not sure is always possible or even if possible is the best approach) are:1. Use a cross-join. Performance unlikely to be any better.2. Use cross-apply. Probably same poor performance.3. Use a recursive CTE - shown below - should perform better.WITH CTE AS( SELECT Record, value, value as RunningTotal FROM ab WHERE Record = 1 UNION ALL SELECT a.Record, a.value, c.RunningTotal + a.value FROM ab a INNER JOIN CTE c ON c.Record+1 = r.Record)SELECT * FROM CTE OPTION (MAXRECURSION 0);
This assumes that data in the Record column has no gaps; if not a preceding CTE that generates consecutive row_numbers would be required.