Solved

SSIS Creating Destination Table Dynamically From Source Table

Posted on 2012-04-10
3
4,994 Views
Last Modified: 2012-04-18
Hello Experts,
When creating a Dataflow task within SSIS, the source is created and then a OLE DB Destination is added, there's an option to Create a table dynamically when you press the NEW button inside the OLE DB Destination Editor.

I'd like to build an SSIS package Programatically and I would like to create the destination table dynamically, just as if I press the New button within the code.  Would anyone know how to do this?

Your insight is appreciated.

Thank you.
0
Comment
Question by:DBL9SSG
  • 2
3 Comments
 
LVL 30

Expert Comment

by:Reza Rad
ID: 37832028
you need to generate the CREATE TABLE command dynamically with an expression and run it in an Execute SQL Task right before the data flow task.
or you can use SELECT ... INTO ... command in an execute sql task instead of data flow task to create the destination table structure based on selected structure.
0
 

Author Comment

by:DBL9SSG
ID: 37832505
Reza_Rad,
Thank you for the comment, however, want I'm looking for is the code behind the "New" button.  Since the source is already created, how do I go about generating the CREATE TABLE command with the associated columns and column_types from the source?
0
 
LVL 30

Accepted Solution

by:
Reza Rad earned 500 total points
ID: 37835455
the NEW button will fetch metadata information from INPUT COLUMNS and generate the Create table command based on it.
So if you want to do that you should write a script component to loops through input columns and generated sql script for create table and run it. and finally map whole columns together.
But note that you need to do all of those in SCRIPT and this will be hard.
your other ways are what I mentioned earlier, which are much easier and better because SSIS data flow is not designed for dynamic metadata.
If you need more help let me know where exactly in detail you need more information.
0

Featured Post

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Microsoft Reports are based on a report definition, which is an XML file that describes data and layout for the report, with a different extension. You can create a client-side report definition language (*.rdlc) file with Visual Studio, and build g…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
In a recent question (https://www.experts-exchange.com/questions/28997919/Pagination-in-Adobe-Acrobat.html) here at Experts Exchange, a member asked how to add page numbers to a PDF file using Adobe Acrobat XI Pro. This short video Micro Tutorial sh…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question