How do I retrieve only the top x rows from a flatfile in SSIS

╄→гoц情女王★ 提交于 2020-01-15 06:47:08

问题


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!


回答1:


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.




回答2:


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

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




回答3:


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



来源:https://stackoverflow.com/questions/1476536/how-do-i-retrieve-only-the-top-x-rows-from-a-flatfile-in-ssis

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!