SSIS 使用包含 ID 和更新值的平面文件更新行
我是 SSIS 新手,并尝试创建一个数据流任务来完成此类事情:
UPDATE dbo.table1
SET lastname = t2.lastname
FROM table1 t1
JOIN table2 t2
ON t1.Id = t2.Id
除了我想使用制表符分隔文件中的 table2 值来完成此操作,如下所示:
ID lastname
1 卡罗尔
2 帕特尔
3 Smith
我不想将表 2 ETL 到数据库中。
我尝试使用平面文件提取值,然后添加 OLE DB 数据目标,但这会导致 SSIS INSERT 值,而不是加入 ID 和 UPDATING em> 列出的字段。
使用 SSIS 进行此类更新的正确方法是什么?
TIA,
特雷·卡罗尔
I'm new to SSIS and trying to create a dataflow task that will accomplish this type of thing:
UPDATE dbo.table1
SET lastname = t2.lastname
FROM table1 t1
JOIN table2 t2
ON t1.Id = t2.Id
Except I want to do it with the values for table2 being in a tab-delimited file like this:
ID lastname
1 Carroll
2 Patel
3 Smith
And I don't want to have to ETL table 2 into the database.
I have tried using a flat-file to pull in the values and then adding an OLE DB Data Destination, however this causes SSIS to INSERT the values rather than joining on the ID and UPDATING the field listed.
What is the correct way to approach an update of this kind with SSIS?
TIA,
Trey Carroll
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我就是这样做的:
这种方法的缺点是它会为匹配的每一行执行 SQL 命令,而且效率可能很低。这个数字很高。如果您可以将平面文件加载到临时表,然后执行更新,那么效率会更高。
This is how I'd do it:
The con of this approach is that it executes the SQL command for every row that matches, and it can be inefficient it that number is high. It would be much more efficient if you could load the flat file to a temporal table, and then perform the update.