简体   繁体   中英

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. 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. 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.

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)? 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).

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.
  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 command like this: select PackageName from metadataTable where Flag =1 retrieves the list of packages that need to be executed.
  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 .

Samuel Vanga has a solid approach. The only thing I would look at doing is using something to programmatically generate those 1200 packages.

Depending on your familiarity with the SSIS object model and general .NET development, I'd investigate an EzAPI if you enjoy coding.

Otherwise, look at BIML and the package generation feature of 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. Copy, paste, generate.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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