Scenario 17: Target table rows , with each row as sum of all previous rows from source table.
Scenario 17: How to produce rows in target table with every row as sum of all previous rows in source
table ? See the source and target table to understand the scenario?
SOURCE TABLE
id Sal
1 200
2 300
3 500
4 560
TARGET TABLE
Id Sal
1 200
2 500
3 1000
4 1560
How to achieve this in SSIS in various ways....(inlcuding any SQL quries)......?
Thanks and Regards,
Desparado.
April 18th, 2011 3:34am
Check this solution:
http://microsoft-ssis.blogspot.com/2011/04/compare-values-of-two-rows.htmlPlease mark the post as answered if it answers your question | My SSIS Blog:
http://microsoft-ssis.blogspot.com
Free Windows Admin Tool Kit Click here and download it now
April 18th, 2011 3:42am
This also can be done with script component as source ( many of your questions can be answered in this way )
you can have a global SUM variable in script component, and in each row add this SUM variable with Sal Column.http://www.rad.pasfu.com
April 18th, 2011 3:44am
This can be achieved using t-sql also. Check this:
Create Table #ST(ID Int,Sal Int)
Insert Into #ST Select 1,200 union select 2,300 union select 3,400
Insert Into #ST Select 4,400 union select 5,350 union select 6,100
Select * from #ST
Select S.ID,SUM(T.Sal) from #ST S Join #ST T
On S.ID>=T.ID
Group By S.IDNitesh Rai- Please mark the post as answered if it answers your question
Free Windows Admin Tool Kit Click here and download it now
April 18th, 2011 4:32am