SSIS : Dynamically passing Table names

2019-08-02 03:13发布

问题:

I want to read more than one table and dump its data into a file.I am not able to pass tables name dynamically to the OLE DB data source, it is working fine for one table.I am not able to see any variable in the drop down list.To accomplish this, I am using these components:

Execute SQL Task :

SELECT name FROM SYS.tables WHERE name IN('A','B')
ResultSet : Table_Name::Variable (Object Type)

ForEach Loop Container :

Foreach ADO Enumerator
variable mapping: Table_Name::Variable

DataFlow Task :

OLE DB Source  <---- How to pass table name dynamicallv
( I am trying to use Table   name variable, but when I click on drop down I don't see  any variable here, I was expecting Table_Name variable there)

Flat File Destination

Flow:

回答1:

Besides object variable, Table_Name, you also need to map a string variable to hold a single table name foreach loop. This is done in the Variable Mappings of the foreach loop enumerator.

Once the string variable is created, you will be able to see it in the Oledb component.



标签: ssis