SQL Server (2000). I have a stored procedure running weekly which summarizes data from a transaction table. Basically tries to keep a running total of all transactions.

Summary Table -
CompanyCode
GL Account
Fiscal Period
NetChangeAmount - Sum of all transactions within the Fiscal period.
BalanceAmount - BalanceAmount + NetChangeAmount of previous Fiscal period
PK = CompanyCode, GL Account, Fiscal Period.

The procedure first updates the NetChangeAmount field for each existing PK.
Then it inserts any new PK records.

The problem is that there may be adjustment transactions to prior periods. These values need to be "rolled forward" into the BalanceAmount field for all later periods which exist in the summary table.

Right now I am using a Cursor and just looping through these transactions but was wondering if there may be a better technique.