简体   繁体   English

使用 SSIS 将数据加载到 SQL 服务器中的多个表

[英]Load data to multiple tables in SQL Server using SSIS

I'm trying to find out how to load data from/to multiple tables in SQL Server.我试图找出如何在 SQL 服务器中的多个表中加载数据。

I have 30+ tables in source and target database (both have the same table names and columns), so I used a foreach loop container to loop through each of the table with 1 DFT.我在源数据库和目标数据库中有 30 多个表(两者都有相同的表名和列),所以我使用了一个 foreach 循环容器以 1 DFT 循环遍历每个表。 I also have variables (SourceQuery & TargetQuery) that holds the query to use in ole db source/destination.我还有变量(SourceQuery 和 TargetQuery),它们保存要在 ole db 源/目标中使用的查询。

But when I use the TargetQuery in ole db destination I'm getting this error:但是当我在 ole db 目标中使用 TargetQuery 时,我收到了这个错误:

错误信息

Anyone know a proper way to use a variable in the ole db destination?任何人都知道在 ole db 目标中使用变量的正确方法吗? Or any other solution would be great as well.或者任何其他解决方案也会很棒。

To copy 30 tables I recommend using the "Transfer SQL Server Objects Task" component that is much more efficient than using a data flow要复制 30 个表,我建议使用比使用数据流更高效的“传输 SQL 服务器对象任务”组件

here you can see how to pass variables在这里你可以看到如何传递变量

Transfer SQL Server Objects Task传输 SQL 服务器对象任务

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM