Thursday, May 26, 2011

SSIS Selective Rows - Using Row Sampling Task

I came across a question today about how to process only the first 10000 rows from a flat file.
It could be done by 3 ways, either using the "RowNumber transformation" from .

or by using a "Script task" which I'll blog about it later or by using the "Row Sampling" Task.

"Row Sampling" would be the easiest way if you need to grab the FIRST 1000 or the FIRST any number.

But using a "Script Task" or the "RowNumber transformation" will grab any selective rows, such as "Grab rows 150 to 400".

Practice  package can be downloaded from :

I'm using here the Data Generator source Task which could be downloaded for free from
just to generate 5000 rows, you can use a flat file as normal.

 Row Sampling configuration.

 And the results...

Hope that helps.