SSIS 任务处理每行的不同目标
我目前的情况是,我让总部将更改推送到分支机构。大约有170家分行。我正在使用的临时表用于将来自总部的数据准备成可以直接插入到分支中的行。我遇到的问题是临时表中的每一行可能会进入不同的分支。
我正在寻找一种策略,可以让我循环遍历临时表中的行,并让我从包含分支 ID 的列插入到目标中。我已经熟悉了粉碎记录集、使用变量的动态连接字符串以及循环容器。主要的难题是如何更改当前行的目标。
我认为这相对简单,但在这种情况下我没有看到森林中的树木。也许我需要以不同的方式处理这个问题?
My current scenario is that I have HQ pushing changes to branches. There's around 170 branches. The staging table that I'm working with is used to prepare the data from HQ into rows that can be inserted directly into a branch. The issue I'm running into is that each row in the staging table might go to a different branch.
I'm looking for a strategy that lets me loop through the rows in the staging table, and lets me do an insert into a destination from the column that contains the branch id. I'm already familiar with shredding a recordset, dynamic connection strings using variables, and looping containers. The main hangup is in how to change the destination of the current row.
I think this is relatively simple, but I'm not seeing the trees from the forest in this case. Maybe I need to handle this differently?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
它永远不会失败。我所需要的只是将其公开发布在某个地方,大约一个小时后,答案就出现了。概述如下:
以下是步骤:
1) 创建分支 ID 及其各自服务器的列表,然后将其放入记录集目标中。
2) 使用 Foreach 循环任务循环访问记录集。映射几个用户变量来存储当前分支和服务器名称。
3) 使用属性编辑器中的表达式修改目标连接(在连接管理器中列出)。将 ServerName 属性映射到存储当前分支的服务器名称的变量。
这设置了一个很好的框架来处理所有集成。我现在可以在 Foreach 循环任务中执行任何需要执行的操作。
希望对某人有帮助!
It never fails. All I needed was to post it publicly somewhere, and the answer came to me, about an hour later. Here's what the overview looks like:
Here are the steps:
1) Create the list of branch IDs and their respective servers, then put it into a Recordset Destination.
2) Loop through the recordset using a Foreach loop task. Map a couple of user variables to store the current branch and server name.
3) Modify the destination connection (listed in the Connection Managers) using the Expressions in the properties editior. Map the ServerName property to the variable that is storing the server name for the current branch.
This sets up a nice framework to handle all of the integration. I can now do anything I need to do inside the Foreach Loop Task.
Hope that helps somebody!