Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

IS it possible to have dynamic sql in ole db src where the table is the part that is dynamic? Expand / Collapse
Author
Message
Posted Monday, October 22, 2012 5:15 PM
Old Hand

Old HandOld HandOld HandOld HandOld HandOld HandOld HandOld Hand

Group: General Forum Members
Last Login: Tuesday, August 12, 2014 8:29 AM
Points: 325, Visits: 733
I am trying to create a for each loop and inside the loop add a dataflow where I pass in a variable with a dynamic query where the only part that changes on iteration of the loop is the table name. I'm doing this because I have 50 databases with 700 tables in each that need to be migrated to another database. I'm begining to think that it may not be possible because the metadata will change on each iteration.


I have it set up to use a Transfer SQL Server Objects task and it works but I dont like the idea of not having any error handling with the task. Is there a way to catch the error and use an exe sql task to insert the name of the table to a log table that caused the error with an Transfer SQL Server Objects task ?
Post #1375785
Posted Tuesday, October 23, 2012 12:35 AM


SSChampion

SSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampion

Group: General Forum Members
Last Login: Yesterday @ 11:26 AM
Points: 13,622, Visits: 10,514
No. SSIS can't handle the changing metadata.

Maybe using the Import/Export wizard can be an option?




How to post forum questions.
Need an answer? No, you need a question.
What’s the deal with Excel & SSIS?

Member of LinkedIn. My blog at LessThanDot.

MCSA SQL Server 2012 - MCSE Business Intelligence
Post #1375849
Posted Thursday, October 25, 2012 12:10 PM


Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Yesterday @ 8:51 PM
Points: 1,117, Visits: 2,220
As Koen have stated this is not possible with the standard SSIS, which only supports static metadata. This means you have to create separate data flow for each table you want to process.

If you can use third-party components, check the commercial COZYROC Data Flow Task Plus. It is an extension of the standard Data Flow Task and it supports dynamic columns at runtime. You can process all your tables with only one For Each Loop (FEL) container and one COZYROC Data Flow Task Plus. No programming skills are required.


---
SSIS Tasks Components Scripts Services | http://www.cozyroc.com/

Post #1377189
Posted Thursday, October 25, 2012 12:37 PM
Old Hand

Old HandOld HandOld HandOld HandOld HandOld HandOld HandOld Hand

Group: General Forum Members
Last Login: Tuesday, August 12, 2014 8:29 AM
Points: 325, Visits: 733
Nice! I will see if we can use 3rd party
Post #1377201
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse