[英]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.