使用SSIS将包含数据的选定表复制到另一个数据库 [英] Copy selected tables with data from one database to another using SSIS

查看:488
本文介绍了使用SSIS将包含数据的选定表复制到另一个数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想将表的列表从一个数据库传输到另一个数据库以及数据。如果目标数据库中存在表,则将其删除并使用源表结构创建并从源表复制数据。表列表可以在.txt文件中指定。



SSIS包循环遍历列表中的每个元素并删除目标表(如果仅存在),创建具有源结构的表并复制源数据库中的数据。

推荐答案

那你的问题是什么?,

1.你可以非常好的循环通过for-each并且可以跟踪.txt文件中的表名。

2.并运行批处理文件转换将目标数据库中的表删除(确保仅在它们存在时丢弃,使用If存在下拉约束)

3.将数据拉到新表中 -

So what is your problem??,
1. you can very well loop via for-each and can trace the table names from the .txt file.
2. And run a batch file transformation drop the table in destination database( make sure that drop only if they exists, use If exists with the drop constraint)
3. pull the data to the new table as-
Select * into [port address].[DestinationDatabaseName].dbo.DestinationTableName from [port address].[DatabaseName].dbo.SourceTableName







使用数据流任务来执行此操作。





希望有所帮助。



OR
Use data flow task to do it.


Hope it helps.


这篇关于使用SSIS将包含数据的选定表复制到另一个数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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