Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 SSIS and Import/Export (2005)
 How to implement ROW_NUMBER in SSIS?

Author  Topic 

gk03
Starting Member

3 Posts

Posted - 2010-08-19 : 17:28:24
Hi Experts,

I wanted to implment row_number() functionality using SSIS, can any tell me how to achieve it, I have done by incrementing counter with 1 by refering below link but still I'm missing partition by.

http://beyondrelational.com/blogs/niteshrai/archive/2010/04/05/incrementing-a-column-value-in-ssis.aspx

Here is my table with ID column:-

Create table ABC( ID INT )
INSERT INTO ABC VALUES (1)
INSERT INTO ABC VALUES (1)
INSERT INTO ABC VALUES (2)
INSERT INTO ABC VALUES (2)
INSERT INTO ABC VALUES (2)
INSERT INTO ABC VALUES (3)
INSERT INTO ABC VALUES (3)

SELECT ID, ROW_NUMBER() OVER(PARTITION BY ID ORDER BY ID) 'Row' FROM ABC


Please, I don't want to do with row_number() third party transformation rather I wanted to achieve it with SSIS in-build transformation tasks.

Help me please.

Thanks
Regards,
Kumar

gk03

gk03
Starting Member

3 Posts

Posted - 2010-08-19 : 17:30:23
I want my expected output to be:-
1
2
1
2
3
1
2


Same as we perform by using row_number() in management studio, but here I want to do with SSIS transformation tasks.

Thanks

gk03
Go to Top of Page

Damian22
Starting Member

1 Post

Posted - 2011-08-18 : 04:24:28
Hi,

I was wondering if anyone ever managed to find an easy way of doing this? I'm currently using a very complex SQL statement to get the data, defeating the point of using SSIS really, and have looked into using an execute Script task, but it can't seem to write to the variables I was thinking of using to keep track of the grouped columns except at the pre and post execute and not in the row processing.

Any help would be appreciated,

Damian.
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2011-08-19 : 04:10:28
see

http://support.microsoft.com/kb/908460/en-us?p=1

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -