SSIS 两个临时表
我想引入 XML 源并进行数据转换并在表中更新它。该表中的数据将用于更新另一个表。如何在SSIS中实现这一点?
我明白前两个步骤。但之后就迷失了。
- XML 源(在数据流任务下)
数据转换
OLE DB 目标? (如果我使用 OLE DB 目标,那么我无法再次使用它作为源来更新另一个表)。我应该使用什么组件来完成此操作?
TIA
I would like to bring in an XML source and do data conversion and update it in a table. Data from this table will be used to update another table. How to accomplish this in SSIS?
I understand the first two steps. But lost after that.
- XML Source (under dataflow task)
Data Conversion
OLE DB Destination? (If I use OLE DB Destination, then I cannot use that as a source again to update another table). What component should I be using to accomplish this?
TIA
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
在数据流中,您可以使用条件拆分(如果您希望某些记录以一种方式发送,而另一些记录以另一种方式发送)或组播任务(如果您希望所有记录都发送到两个目的地)将记录拆分为多个表。我们使用多播来创建两个临时表,一个将保留文件中的原始数据,另一个将在数据进入我们的产品表之前对其进行清理和转换。这使我们能够轻松研究传入的某些问题数据是否是由于我们的转换过程(错误)或发送的错误数据(客户端的问题,但如果无法修复,可能需要更多步骤来处理) )。
您还可以拥有多个具有相同源的数据流。或者,您可以插入一个临时表,然后使用第二个数据流或执行 SQL 任务将该数据移动到您想要的位置。
Within a dataflow you can split the records to go to multiple tables using either a conditional split (if you want some records to go one way and some to go another way) or a mulicast task if you want all records to go to both destinations. We use a multicast to create two staging tables, one where the raw data from the file will stay and one where the data will be cleaned and transformed before going into our prod tables. This enables us to easily research if some problem data that came in was due to our transformation process (a bug) or bad data being sent (a problem at the client end, but which might require more steps to handle if they can't fix).
You can also have multiple data flows that all have the same source. Or you can insert to one staging table and then have a second data flow or exec SQL task to move that data to where you want it.
使用 OLE DB 目标将 XML 源数据注入到临时表中。然后,在控制流中,在数据流任务之后使用执行 SQL 任务来执行存储过程或 T-SQL 脚本,以将数据从临时表移至生产表,并根据需要截断临时表。
我发现 SSIS 非常适合 ETL 工作,但是在数据库内移动数据或聚合工作最好在存储过程中使用 T-SQL 来执行。更容易编写、控制,而且您知道在 DFT 中不会遇到任何 RBAR 恶作剧。
青年MMV
Use the OLE DB Destination to inject your XML source data into your staging table. Then, in your control flow use an Execute SQL task after your data flow task to execute a stored procedure or T-SQL script to move your data from the staging table into the production table(s) and truncate the staging table if required.
I've found that SSIS is great for ETL work, but moving data around inside a DB or aggregation work is best carried out using T-SQL in stored procs. Easier to write, control and you know you're not going to have any RBAR shenanigans you can happen upon in a DFT.
YMMV