SQL cumulative calculations without looping
May.11, 2009 in
SQL
I have seen several times some people use loops, cursors to do cumulative calculations. But I think we can use following basic way to do calculations without using loops or cursors .Just create sample table (run attached script) and try following SQL
DECLARE @tempValue FLOAT
SET @tempValue=1
UPDATE Sample SET @tempValue=CalculatedValue=(MonthlyValue+1)*@tempValue
SELECT * FROM Sample


June 12th, 2009 at 5:38 pm
The article is ver good. Write please more