Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Aggregator transformation.....how to get all columns in output


Aggregator transformation.....how to get all columns in output

Author
Message
sattar419 10789
sattar419 10789
Forum Newbie
Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)

Group: General Forum Members
Points: 6 Visits: 25
Hi all,

I am trying to use Aggregator transformation to do the sum on one column based on group by on another column, but when i do it i am getting on these two columns in the output records... I have 23 other columns that i want as output column. How to achieve this in ssis.

Below is what i have in my package.

Source which has 25 columns
Aggregator ( group by on column1 and sum on column2)
output ( I need all 25 columns) ?
Jeff Moden
Jeff Moden
SSC-Forever
SSC-Forever (45K reputation)SSC-Forever (45K reputation)SSC-Forever (45K reputation)SSC-Forever (45K reputation)SSC-Forever (45K reputation)SSC-Forever (45K reputation)SSC-Forever (45K reputation)SSC-Forever (45K reputation)

Group: General Forum Members
Points: 45163 Visits: 39924
sattar419 10789 (5/29/2014)
Hi all,

I am trying to use Aggregator transformation to do the sum on one column based on group by on another column, but when i do it i am getting on these two columns in the output records... I have 23 other columns that i want as output column. How to achieve this in ssis.

Below is what i have in my package.

Source which has 25 columns
Aggregator ( group by on column1 and sum on column2)
output ( I need all 25 columns) ?


I can't speak for SSIS but here's how I might do it in T-SQL... that is, if it made sense to do so. The "aggregator" will give you the sum of all Column2s grouped by Column1 and will be repeated for each unique value for Column1 (as in "group").

SELECT Column1
,Aggregator = SUM(Column2) OVER (PARTITION BY Column1)
,Column2
,Column3
,Column4
,Column5
,Column6
,Column7
,Column8
,Column9
,Column10
,Column11
,Column12
,Column13
,Column14
,Column15
,Column16
,Column17
,Column18
,Column19
,Column20
,Column21
,Column22
,Column23
,Column24
,Column25
FROM dbo.YourTable

--Jeff Moden

RBAR is pronounced ree-bar and is a Modenism for Row-By-Agonizing-Row.
First step towards the paradigm shift of writing Set Based code:
Stop thinking about what you want to do to a row... think, instead, of what you want to do to a column.
Although they tell us that they want it real bad, our primary goal is to ensure that we dont actually give it to them that way.
Although change is inevitable, change for the better is not.
Just because you can do something in PowerShell, doesnt mean you should. Wink

Helpful Links:
How to post code problems
How to post performance problems
Forum FAQs
Phil Parkin
Phil Parkin
SSCrazy Eights
SSCrazy Eights (8.4K reputation)SSCrazy Eights (8.4K reputation)SSCrazy Eights (8.4K reputation)SSCrazy Eights (8.4K reputation)SSCrazy Eights (8.4K reputation)SSCrazy Eights (8.4K reputation)SSCrazy Eights (8.4K reputation)SSCrazy Eights (8.4K reputation)

Group: General Forum Members
Points: 8381 Visits: 19501
Jeff's suggestion is a good one. Aggregation in SSIS is a blocking transformation and should be avoided if possible. It's also slower than the SQL Server database engine.


Help us to help you. For better, quicker and more-focused answers to your questions, consider following the advice in this link.

If the answer to your question can be found with a brief Google search, please perform the search yourself, rather than expecting one of the SSC members to do it for you.

Please surround any code or links you post with the appropriate IFCode formatting tags. It helps readability a lot.
Koen Verbeeck
Koen Verbeeck
SSCoach
SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)

Group: General Forum Members
Points: 16465 Visits: 13207
Phil Parkin (6/4/2014)
Jeff's suggestion is a good one. Aggregation in SSIS is a blocking transformation and should be avoided if possible. It's also slower than the SQL Server database engine.


And you cannot do window aggregations with that component, which seems to be the use case here.
Conclusion: use TSQL :-D



How to post forum questions.
Need an answer? No, you need a question.
What’s the deal with Excel & SSIS?

Member of LinkedIn. My blog at SQLKover.

MCSA SQL Server 2012 - MCSE Business Intelligence
MMartin1
MMartin1
Ten Centuries
Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)

Group: General Forum Members
Points: 1114 Visits: 2015
In the Aggregator transform you select columns to group by and those to aggregate on, so the other 23 would indicate a group by. Note that you can use this Aggregator instead of t-sql if you're data is not all on the same machine. SSIS is meant for pulling data from different systems and will perform better in this regard. If all your data is on the same machine, use t-sql in the data source instead.
Best

----------------------------------------------------
How to post forum questions to get the best help
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search