Cumulative Insert Query | SQL Server Performance Forums

SQL Server Performance Forum – Threads Archive

Cumulative Insert Query

Folks I am having a Scenario which is as follows. Consider That there is a table with the name DEP_tAcctBalnHisthdr with the following data Pk_IDPrdIDAcctIDBusnsDtInsGrpIDInsGrpSlNoAvailedAmt
43283697003-04-200650025600 Now I want to insert 3 more records to the above table.
These 3 records are as follows Pk_IDPrdIDAcctIDBusnsDtInsGrpIDInsGrpSlNoAvailedAmt
43448697022-04-2006815221250
43449697022-04-2006815222320
43450697022-04-2006815223250 After Insert ,DEP_tAcctBalnHisthdr should look like the one below Pk_IDPrdIDAcctIDBusnsDtInsGrpIDInsGrpSlNoAvailedAmt
43283697003-04-200650025600
43448697022-04-20068152215850
43449697022-04-20068152226170
43450697022-04-20068152236420 Kindly Note that the AvailedAmt is cumulating for each insert. Is there a way to do this task through a single query.
If Not how easily can I Implement this My Insert query is as follows InsertInto DEP_tAcctBalnHisthdr
(
PrdID,AcctID,
BusnsDt,ValueDt,
InsGrpID,InsGrpSlNo,
AvailedAmt
)
SelectPrdID,AcctID,
BusnsDt,ValueDt,
InsGrpID,InsGrpSlNo,
AvailedAmt
From#TempDEP_tAcctBalnHisthdr Deep Regards
Anil
Never Give Up
Where do you want to show the data?
Use reports to generate Running Totals Madhivanan Failing to plan is Planning to fail
Dear Friend It is not for Report Purpose.
That query forms the part of a day to day bank transaction Regards
Anil Never Give Up
See if this helps
http://www.sql-server-performance.com/forum/topic.asp?TOPIC_ID=13574&whichpage=1 Madhivanan Failing to plan is Planning to fail
]]>