SSIS ForEach循环-更改for循环内的连接 [英] SSIS ForEach loop - change connection inside a for loop

查看:126
本文介绍了SSIS ForEach循环-更改for循环内的连接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

任务-有7台SQL服务器,每台都有相同的数据库。考虑数据库的表Table_1。我想从所有7台服务器的Table_1中获取数据,并将其放入主服务器的Table_1中(在下图中称为DataWarehouse)。我创建了一个数据流任务,将数据从这些服务器之一移动到主服务器。

Task - There are 7 SQL servers, each of which have the same database. Consider a table Table_1 of the database. I want to take data from Table_1 of all the 7 servers and put it into Table_1 of Main server (called DataWarehouse in photo below). I created a data flow task to move data from one of these servers to main server.

现在,我想将此数据流任务放在for循环中并执行数据从7个服务器中的每一个流向主服务器。我该怎么做?

Now, I want to put this data flow task inside a for loop and do the data flow from each of the 7 servers to the main server. How do I do it ?

请参阅下面的附件照片。我希望我的foreach循环更改在数据流任务数据集市-一台服务器中定义的连接,然后进行数据传输。这有可能吗?如果是,那怎么办?我希望可以像编程中那样简单-

Please see the attached photos below. I want my foreach loop to change the connection defined inside the data flow task "Data Mart - One Server" and then do the data transfer. Is this even possible ? If yes, then how ? I am hoping for something simple like we have in programming -

//pseudocode

foreach (String serverIP){

1 - connect to server using serverIP

2 - move data from server called serverIP to destination

}

推荐答案

是。我假设您可以在foreach循环中,使用服务器名称填充变量。在此处,单击您的连接管理器,然后打开属性窗格(如果尚未显示,请按F4键)。单击表达式,然后将ServerName属性设置为您的服务器名称变量。

Yes. I'm assuming that you can, as part of your foreach loop, populate a variable with the name of the server. From there, click on your connection manager and bring up the properties pane (hit F4 if it's not already up). Click on "Expressions" and set the ServerName property to your server name variable.

这篇关于SSIS ForEach循环-更改for循环内的连接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆