2

I have a flatfile connection and I'm only interested in the first 10 rows of data. How can I just import the first 10 rows? Row sampling is random so I can't use that. Is there some way I can have some sort of derived column which is an automatic row number or something and then data-split to only keep rows with that id <= 10?

Any help much appreciated!

Jonas
  • 121,568
  • 97
  • 310
  • 388
neiled
  • 169
  • 1
  • 9
  • Can you use a Script Component as a data flow source? If so this is simple to implement. – Faiz Sep 27 '09 at 05:49

3 Answers3

2

I've used this component --> http://www.sqlis.com/post/Row-Number-Transformation.aspx

The component creates a new variable with a row number. You can use a conditional split to take the first 10 records based on the variable the component creates.

One catch is that you will need to read in the entire file. Depending on your file size you may want to seek another solution.

CTKeane
  • 674
  • 1
  • 9
  • 22
0

There isn't a direct way of doing that. You can try a work around method by using the "Data rows to skip" property:

Screenshot of the connection manager editor

You can "invert" your file and skip all first rows -10

Deanna
  • 23,876
  • 7
  • 71
  • 156
Diego
  • 34,802
  • 21
  • 91
  • 134
0

Just use a lineCount component with a user variable and a conditional Split based on the value of that variable/