0

I have to extract few (5) tables (from Ingres DB) using ODBC connection and load the same in OLE-DB (SQL Server).

1). OLE-DB based connection extract 5 tables name. 2). Using Conrol flow (For each loop container), loading variable (i.e. loop_var_tablename) for each table 3). For source connection:

  • Using ODBC connection -> Expressions -> Sqlcommand="ingres."+@[User::loop_var_tablename] enter image description here

4). For detination connectin:

  • Using OLE-DB connection -> Data access mode: table name or veiew name variable @[User::loop_var_tablename] enter image description here

Problem statement: Since the table name is being loaded Dynamically. Thus, i can not adjust 'Mapping' in Source and Destination. How to proceed with it?

I would really appreciate if you could guide me on this issue.

Thanks in advance!

Thank you KN

Expecation: Table should be loaded from Source (Ingres db) to Target (MS SQL Server).

failed attempt xx: In source connection/ODBC When -> Expressions -> Sqlcommand="ingres."+@[User::loop_var_tablename]

Errors:

Information: 0x4004300A at Data Flow Task, SSIS.Pipeline: Validation phase is beginning.
Error: 0x321 at Data Flow Task, ODBC_Extract_Rows [8]: Error getting schema information. Table has no columns
Error: 0xC004706B at Data Flow Task, SSIS.Pipeline: "ODBC_Extract_Rows" failed validation and returned validation status "VS_ISBROKEN".
Error: 0xC004700C at Data Flow Task, SSIS.Pipeline: One or more component failed validation.
Error: 0xC0024107 at Data Flow Task: There were errors during task validation

failed attempt yy: In source connection/ODBC When -> Expressions -> Sqlcommand="select * from ingres."+@[User::loop_var_tablename]

Errors:

Information: 0x4004300A at Data Flow Task, SSIS.Pipeline: Validation phase is beginning.
Error: 0xC004706B at Data Flow Task, SSIS.Pipeline: "ODBC_Extract_Rows" failed validation and returned validation status "VS_NEEDSNEWMETADATA".
Error: 0xC004700C at Data Flow Task, SSIS.Pipeline: One or more component failed validation.
Error: 0xC0024107 at Data Flow Task: There were errors during task validation.

I also changed OLE-db connection (Destinatino) 'Data access mode: Table name or view name variable -fast load'. The issue persists.

khurram
  • 1
  • 1

1 Answers1

0

You can't. An SSIS data flow is not a generic "anything to anything" data moving tool. You can dynamically switch the destination from A to Z as long as the schema is the same for the columns that are being mapped (extra columns in table Z? No problem).

The metadata for an SSIS package is set at design time aka when you're in the Visual Studio editor. When it's running loop 1, your approach will work as the current table matches the expected metadata. Loop 2, everything is "different" and boom, VS_NEEDSNEWMETADATA.

For five tables, just add 5 data flows and be done with it. Dynamic is good, there's lots of things that can be done there but the amount of effort it's going to take versus just doing what's needed weighs heavily towards adding a data flow per table.

What can be dynamic is the table name. I often work in environments where the database/schema/tablename get environment specific values added "DevSalesDB.DevSchema.DevSalesPerson" because someone was super worried someone would confuse DevDatabaseServer with ProdDatabaseServer. In cases like that, your Expressions would be needed as the schema is the same for the sales person table but the actual name changes across environments as you deploy.

billinkc
  • 59,250
  • 9
  • 102
  • 159
  • Hi @Billinkc- Thank you for your reply. Please assume source and target have same number of columns. As we already doing it manually thus mapping isn't issue. In future, we will be having more tables (i.e. 5 to 500) we need to automate it. Should i/do i have other option than ODBC to extract data from Ingres table to SQL Server table? – khurram Jun 06 '23 at 14:27
  • If the problem is "I need to build N packages that copy data from one server to the other," then my answer will be [Biml](https://www.bimlscript.com/) Creating 5 to 500 packages will take the same amount of work using BimlExpress. I don't have an Ingres example but the pattern on http://billfellows.blogspot.com/2013/11/ssis-copy-all-tables.html or https://billfellows.blogspot.com/2015/01/biml-replicate-o-matic.html would be easily adapted to your use case. I'd generate a package per table and then an orchestrator to coordinate running the packages with some degree of parallelization. – billinkc Jun 06 '23 at 17:01