Row_Number operation in ssis
Hi All, Can I generate Row_Number In SSIS Pakcage using any transformation. I can Go for script Task like Public Class ScriptMain : Inherits UserComponent Private _RowNumber As Integer = 1 Public Overrides Sub Input0_ProcessInputRow(ByVal Row As Input0Buffer) Row.RowNumber = _RowNumber _RowNumber += 1 End SubEnd ClassBut It generates the sequence of RowNumber...I want this sequence should be partitioned by some columnand order by some other column... How Can I Get That in SSIS..?Is there any script for that.. I dont want to write t-sql in my Package, Thats My boss Order..Thanks..
December 17th, 2010 4:21pm

The best solution would be to use the T-SQL DENSE_RANK function, but if that's not possible... So BEFORE your script task, put in a SORT Transform and SORT the rows any and all columns that you want to be defining RANK for. Next, send it to your script task as above, but modify it so that it also reads the contents of the sorted columns. Then re-set the Row Number variable back to 1 when it sees a new value in the Column.Todd C - MSCTS SQL Server 2005 - Please mark posts as answered where appropriate.
Free Windows Admin Tool Kit Click here and download it now
December 17th, 2010 5:06pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics