简体   繁体   English

在SSIS数据流任务中使用多个源

[英]Using Multiple Sources in SSIS Data Flow Task

For my data flow task I have a OLEDB Source. 对于我的数据流任务,我有一个OLEDB源。 In the SQL command section of this I have compiled a select query based on tables from two different databases, held on the same instance. 在本文的SQL命令部分中,我基于来自同一实例上的两个不同数据库中的表的内容,编译了一个选择查询。 Every time I run this it errors, but when I moved the tables to the same database (for testing purposes) it worked. 每次我运行它都会出错,但是当我将表移到相同的数据库(出于测试目的)时,它就起作用了。

I'm guessing from this that the source data needs to be from the same database but is there anyway around this? 我从中猜测,源数据需要来自同一数据库,但是围绕它存在吗? I tried using a look-up but I couldn't get it to work. 我尝试使用查找,但无法正常工作。 I could create a view in the source database but I'm guessing there must be a way to keep it all within the package. 我可以在源数据库中创建一个视图,但我猜必须有一种方法可以将其全部保留在包中。

Thank you in advance! 先感谢您! This is the query I was using in the OLE DB Source: 这是我在OLE DB源中使用的查询:

select * from commoncomponents.meta.ItemTypeLabelDefinition where internalid not in ( select internalid from iscanimport.dbo.ItemTypeLabelDefinition ) 从commoncomponents.meta.ItemTypeLabelDefinition中选择*,而不是内部标识(从iscanimport.dbo.ItemTypeLabelDefinition中选择内部标识)

Not sure why the cross-DB query wouldn't work in the one source, but one method would be to create two OleDb Sources, one pointing to CommonComponents DB doing the select from ItemTypeLabelDefinition, and the other pointing to IScanImport and the select statement from your sub-query. 不确定为什么跨数据库查询不能在一个源中工作,但是一种方法是创建两个OleDb源,一个指向CommonComponents DB,执行ItemTypeLabelDefinition的select,另一个指向IScanImport和select语句,您的子查询。 Preferably sort these the same way at source in your queries, then use a Merge Join task to combine them. 最好在查询中以相同的方式对这些内容进行排序,然后使用“合并联接”任务将它们合并。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM