如何从 SSIS 中的平面文件中仅检索前 x 行
我有一个平面文件连接,我只对前 10 行数据感兴趣。如何只导入前 10 行? 行采样是随机的,所以我不能使用它。有什么方法可以让我拥有某种派生列,它是自动行号或其他东西,然后进行数据分割以仅保留 id <= 10 的行?
非常感谢任何帮助!
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!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我用过这个组件 --> http://www.sqlis.com/post/Row-Number-Transformation。 aspx
组件创建一个带有行号的新变量。您可以使用条件拆分,根据组件创建的变量获取前 10 条记录。
一个问题是您需要读入整个文件。根据您的文件大小,您可能需要寻求其他解决方案。
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.
没有直接的方法可以做到这一点。您可以使用“要跳过的数据行”属性尝试解决方法:
您可以“反转”您的文件并跳过所有第一行 -10
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
只需使用带有用户变量的 lineCount 组件和基于该变量的值的条件分割/
Just use a lineCount component with a user variable and a conditional Split based on the value of that variable/