How to get only top x lines from flatfile in SSIS
I have a flatfile connection and I am only interested in the first 10 lines of data. How can I import the first 10 lines? The selection of rows is random, so I cannot use it. Is there some way I can have some kind of derived column that is an automatic row number or something and then split into data to store rows with only that id <= 10?
Any help is greatly appreciated!
+2
source to share
3 answers
I used this component -> http://www.sqlis.com/post/Row-Number-Transformation.aspx
The component creates a new variable with a line number. You can use conditional splitting to accept the first 10 records based on a variable generated by the component.
One catch is that you will need to read the entire file. Depending on your file size, you may be looking for another solution.
+2
source to share