Click here to Skip to main content
15,881,709 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a single sql server on which there are multiple databases and inside all the databases there are tables.

So the situation is like below:-

DB1> table1
DB2> table2

I want a package to dynamically pick the db and inside that the table and push data to flat file.

What I have tried:

I have created a master table consisting of servername,tablename,databasename and the entire connectionstring and I have stored the result of the above in object variable.

below this I have a foreachloop container which has been mapped to the enumerator configuration variable and under this to the same object variable.

Also the variable mappings has also been done.


Inside foreach loop container I have placed a dft and created one more connection manager which takes connection string as expression and in that I map the complete connectionstring variable.

when I run this the loop runs twice but the data is copied for the default connection only.
Posted
Updated 4-Nov-19 5:11am

1 solution

Write a stored proc to build/execute the dynamic sql, and call the stored proc from your package. Then, the package can save the returned data as a file.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900