简体   繁体   English

SSIS - 从名称基于变量的不同服务器连接表

[英]SSIS - Join tables from different servers whose names are based on a variable

I have a simple query based on tables from two different linked servers. 我有一个基于来自两个不同链接服务器的表的简单查询。 I need both servers to be changeable since we're moving from DEV to UAT to Production. 我需要两个服务器都可以更改,因为我们正在从DEV转移到UAT到Production。 I'm using an expression to set the Connection String and Password for server A. So, using that as a base I set a Data Flow Task and an 'OLE DB Source' to extract the data I need. 我正在使用表达式为服务器A设置连接字符串和密码。因此,使用它作为基础我设置数据流任务和'OLE DB源'来提取我需要的数据。 Ultimately I'd like my query to look like this: 最终,我希望我的查询看起来像这样:

Select * from A.Payments p1
Full Outer Join ?.Payments p2 on p1.Id = p2.Id 
where p1.OrderDesc is null or p2.OrderDesc is null

Is there a way around it? 有办法解决吗? Can I use a variable or some kind of dynamic query? 我可以使用变量或某种动态查询吗? I haven't managed to parse a project parameter and run one. 我没有设法解析项目参数并运行一个。 Thank you very much for your help. 非常感谢您的帮助。

This is done by making the Data Source SQL an expression. 这是通过使数据源SQL成为表达式来完成的。

Right click the Data Flow and then click the ellipsis [...] beside "Expressions". 右键单击“数据流”,然后单击“表达式”旁边的省略号[...]。 In there you will find one of the available properties you can set is the SQLCommand for your Data Flow Source. 在那里,您会发现可以设置的一个可用属性是数据流源的SQLCommand。

It's not the most intuitive thing to be fair. 公平地说,这不是最直观的事情。

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

相关问题 实体框架4,我可以在同一模型中拥有来自不同数据库服务器的2个表吗? - Entity Framework 4, can I have 2 tables from different db servers in the same model? 从变量名中删除m_前缀 - removing m_ prefix from variable names 在sis软件包中使用临时表 - Using temporary tables in ssis package SSAS-从不同的表创建命名计算 - SSAS - Creating named calculation from different tables SSIS For Loop重置变量值 - SSIS For Loop resetting the variable value 无法从 Visual Studio 中的 SSMS 正确打开基于 SSIS 包的作业 - Can't open properly a SSIS package based job from SSMS in Visual Studio 是否可以在不同的TFS服务器之间进行合并或分支? - Is it possible to Merge or Branch between different TFS servers? 从同一文本框更改事件中的两个不同表中获取数据 - fetch data from two different tables on same textbox changed event 如何使用Telerik Open Access从不同数据模型的不同表中获取数据 - How to get the data from different tables from different data models using telerik open access ASP.Net多个联接表从Sqldatasoruce查询生成器发布到一个gridview中 - Asp.Net multiple join tables issue from Sqldatasoruce Query Builder into one gridview
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM