问题描述
我正在尝试设计一个 SSIS 包,它将大约 50 多个表从 ODBC 数据源(QuickBooks DB)复制到 SQL DB.我应该创建 50 个数据流任务来执行此操作吗?做这个的最好方式是什么 ?将 DFT 放入循环中,然后读取表格?或者 50+ 数据流任务???
I am trying to design an SSIS package which copy about 50+ tables from an ODBC DataSource (QuickBooks DB) to an SQL DB.Should I create 50 Data Flow Task to do this ?What is the best way to do this ?Putting DFT inside a Loop, and reading the tables ? Or 50+ Data Flow Tasks ???
推荐答案
您可以创建 50 个数据流任务,但不是必须的.
You can create 50 Data Flow Tasks, but you don't have to.
在同一个 DFT 中可以有多个独立的源-目的地.这将不那么灵活,因为您可以独立于包运行单个 DFT(在调试时),但您不能在不修改它的情况下运行一段 DFT(据我所知).
It is possible to have multiple independent sources-destinations in the same DFT.This will be not as flexible, because you can run single DFT separately from the package (while debugging), but you cannot run a piece of DFT without modifying it (as far as I know).
根据您选择的选项,我看到了几种方法可以让您免于处理 50 多张桌子的平凡工作:
Depending on which option you choose, I see a couple of ways to save yourself from mundane work with 50+ tables:
a) 让 SQL Server 导入和导出向导做无聊的事为你工作.这个工具最好的地方是它可以创建一个 .dtsx 包.
a) Let SQL Server Import and Export Wizard do the boring work for you.The best about this tool is that it can create a .dtsx package.
因此,使用向导,您可以:
So, with the wizard, you can:
- 选择从 ODBC 数据源导入所有 50 多个表
- 不要一直运行向导,而是将结果保存为 .dtsx 包.
- 使用 SQL Server Data Tools 在 Visual Studio 中打开包
- 根据您的需要修改包(例如,在不同的 DFT 中对表进行逻辑重组,添加任何其他转换).
b) 手动编辑包代码(一些BIML 知识可能需要):
b) Manually edit the package code (some BIML knowledge might be needed):
- 在带有 SQL Server Data Tools 的 Visual Studio 中,创建 1 个 DFT 作为您的示例.
- 在 Solution Exporer 中,右键单击您的包,选择查看代码.
- 复制/粘贴 DFT 50 次以上,更改表名,或者您甚至可以设法以某种方式自动化 BIML 以避免复制/粘贴
这篇关于使用 SSIS 包复制多个表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!