简体   繁体   English

如何使用基于自定义(egXML)文件的SSIS导入选择性表

[英]How to import selective tables using SSIS based on custom (e.g.XML) file

I am having about 1200 tables in my oracle database and need to import them to SQL Server database. 我在我的oracle数据库中有大约1200个表,需要将它们导入SQL Server数据库。 But I would like to configure the import in such a way that at any given import, I should be able to select the tables that need to be imported. 但我想以这样的方式配置导入:在任何给定的导入中,我应该能够选择需要导入的表。

So, I have an custom XML file listing all the tables and a flag for each table indicating whether that table is to be imported or not. 因此,我有一个自定义XML文件列出所有表,并为每个表指示是否要导入该表。 Also I have created the package to import all the tables and would like to modify this to check table if that is to be imported from XML file at runtime. 我还创建了导入所有表的包,如果要在运行时从XML文件导入,我想修改它以检查表。

I was thinking to implement something like given here , but don't want to do this for these many tables and also don't know whether it'll do the job. 我想在这里实现类似的东西,但是不想为这么多表做这个,也不知道它是否能完成这项工作。

How can I get around this? 我怎么能绕过这个? Can I use SSIS configuration file for this (not sure though)? 我可以使用SSIS配置文件(不确定)吗? Is there any way that I can read XML at runtime and import tables based on XML file (or any other file with key-value pairs). 有没有什么办法可以在运行时读取XML并根据XML文件(或任何其他具有键值对的文件)导入表。

Any help in any form would be greatly appreciated. 任何形式的任何帮助将不胜感激。

It might seem a lot of work, but this is how I'd approach: 这似乎有很多工作,但这就是我的方法:

  1. Create one package for each table that needs to be imported - so 1200 packages. 为每个需要导入的表创建一个包 - 所以1200个包。
  2. Store the package names in a metadata table along with a flag column, indicating whether that packages needs to be executed or not. 将包名称与标志列一起存储在元数据表中,指示是否需要执行包。
  3. Create a parent package. 创建父包。
  4. Add an execute sql task in the parent package. 在父包中添加一个执行sql任务。 SQL command like this: select PackageName from metadataTable where Flag =1 retrieves the list of packages that need to be executed. 像这样的SQL命令: select PackageName from metadataTable where Flag =1检索需要执行的包列表。
  5. Map the result set to an object variable. 将结果集映射到对象变量。
  6. Add a for each loop container. 为每个循环容器添加一个。
  7. Add Execute package task inside the for each loop container, and parametrize the package name property. 在每个循环容器中添加执行包任务,并参数化包名称属性。

This whole setup reads the packages that needs to be executed, and executes them one after the other. 整个安装过程将读取需要执行的程序包,然后一个接一个地执行它们。

If you like this approach, check out Andy Leonard's SSIS framework . 如果您喜欢这种方法,请查看Andy Leonard的SSIS框架

Samuel Vanga has a solid approach. 塞缪尔·万加(Samuel Vanga)采取扎实的态度。 The only thing I would look at doing is using something to programmatically generate those 1200 packages. 我唯一要做的就是使用某些东西以编程方式生成这些1200包。

Depending on your familiarity with the SSIS object model and general .NET development, I'd investigate an EzAPI if you enjoy coding. 根据您对SSIS对象模型和一般.NET开发的熟悉程度,如果您喜欢编码,我会调查一个EzAPI

Otherwise, look at BIML and the package generation feature of BIDSHelper . 否则,看BIML包产生的功能BIDSHelper You do not need to by a license for Mist to create your BIML script, you can browse the existing scripts on BIMLScript and solve probably most of your needs. 您无需通过Mist许可证来创建BIML脚本,您可以浏览BIMLScript上的现有脚本并解决您的大部分需求。 Copy, paste, generate. 复制,粘贴,生成。

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

相关问题 如何使用SSIS将多个Access表导入SQL Server - How to import multiple Access tables into SQL Server using SSIS 使用 SSIS 将具有多个表的单个 mdb 文件动态导入 SQL Server? - Dynamically import Single mdb file with multiple tables into SQL Server using SSIS? 如何在没有选择列的情况下将MySqlDump文件导入MySQL - How to Import MySqlDump File into MySQL without Selective Columns 如何使用SSIS将所有带有索引和键的表从DB2数据库导入SQL Server 2008? - How to import all tables with indexes and keys from a DB2 database to SQL Server 2008 using SSIS? 在SSIS中使用“标题,详细信息和尾部”部分导入XML文件 - Import XML file with Header, Detail, and Trailer section in SSIS 如何通过使用SSIS将数据从多个表插入到多个表? - How to insert data from multiple tables to multiple tables by using SSIS? 如何从Excel表导入选择性行? - How to import selective rows from an Excel table? 在SQL Server 2005中使用SSIS从平面文件导入时如何保留NULL值 - How do I retain NULL values when using SSIS to import from flat file in SQL Server 2005 使用 SSIS 将 CSV 文件拆分为 SQL 数据库表 - Split the CSV file using SSIS to SQL Database tables 使用 SSIS 将表数据的 XML 表示提取到文件中 - Using SSIS to extract a XML representation of table data to a file
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM