SSIS 数据流 - 条件分割
你好
。
首先请原谅,如果这没有多大意义,因为我对 SSIS 还很陌生(就像两天前一样)。
最终,我希望从 XML 文件导入所有数据,并根据文件类型以不同的方式处理并加载到 Microsoft SQL Server 2008 中的一组关系表。
每个 XML 文件都有一个布尔标志0 或 1。根据是 0 还是 1,我希望数据流以不同的方式进行,因为每种类型的文件需要以不同的方式处理。
我一直在考虑使用条件分割转换,但是遇到了一些问题。
我使用数据流 XML 源获取数据,然后检查标志,然后根据数据向左或向右流动是 0 还是 1。然而,XML 包含大量数据,我只能使用标志移动数据元素,并且我也需要它沿该方向移动其余数据。
我想我可以打开文件检查标志,将标志存储为变量,然后关闭文件并根据变量打开 0 包或 1 包,然后再次打开 xml 文件并提取数据。然而,当我打开和关闭同一个 XML 文件两次时,这“闻起来”不太对劲。
还有其他人遇到过这个问题吗?他们是如何解决这个问题的?
SSIS
Hello.
Firstly excuse me if this doesn’t make a lot of sense as I’m fairly (as in 2 days ago) new to SSIS.
Ultimately I’m looking to import all data from an XML file and depending on what kind of file it is process in a different way and load to a set of relational tables in a Microsoft SQL Server 2008.
Each XML file has a Boolean flag of 0 or 1. Depending on if its 0 or 1 I would like the data flow to go a different way as each type of file needs to be processed differently.
I’ve been looking at using the conditional split transformation however I’ve come across a couple of issues.
I get the data using a dataflow XML source and check the flag then depending on if its 0 or 1 the data flows left or right. However the XML contains lots of data and I can only move the data element with the flag and I need it to move the rest of the data in that direction as well.
I thought I might open the file check the flag, store the flag as a variable then close the file and open a 0 package or a 1 package depending on the variable which would then open the xml file again and pull out the data. However this doesn’t “smell” right as I’m opening and closing the same XML file twice.
Has anyone else come across this and how did they get around it?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
虽然我不认为在 ETL 操作中打开文件两次有什么问题,但您可以通过单个数据流任务来实现您的目标,该任务包括一个条件拆分组件,该组件使用变量(或派生列等)作为条件表达式。通过使用脚本组件,可以在数据流任务中轻松实现变量的设置。
Although I don't think anything wrong with opening a file twice in an ETL operation, you can achieve your goal with a single data flow task that includes a conditional split component which uses a variable (or derived column etc) for condition expression. Setting the variable can be easily implemented in data flow task by using a script component.