Quantcast
Channel: SQL Server Integration Services forum
Viewing all articles
Browse latest Browse all 24688

Variable to dynamically change tablename for Data flow task

$
0
0

Hi everybody,

I have the following question.
I would like to make an SSIS Package which Extracts data from different tables to my staging area.
I made this in a static way but would like to do it dynamically.

Here is the situation.

I have one Database. In the Database are Tables which have a certain structure. I try to explain it by the example of the table Item.
Because the DB is of an ERP- System the table Item exists several times. For every Company within the ERP once.
So I have the table "dbo.Company": There are only two columns. Timestamp and Name.
The Name stands for the company i.e.

dbo.Company
Timestamp -- Name

2010-01-01 -- Booksstore
2010-01-01 -- Bikestore

Further more I have the table dbo.bookstore$item and dbo.bikestore$item

Now I would like to make a function or stored procedure where a variable is filled with the first company name from dbo.company (i.e. bookstore).
@variable = 'bookstore'

Then the Data Flow Task uses this variable to call the item table (~ dbo.@variable'+ $item').  This should be repeated with an enumerator.

But I don't know how to write this.
Does anybody has an idea or tip? Tutorials are welcome.

Thank you in advance.
With kind regards.

Tobi

P.S. Eventhough I already have a static soultion, I would like it dynamic because in the future there will be more an more companies in the database.It is much easier to run it on a dynamic basis instead of copying every task over and over again.


Viewing all articles
Browse latest Browse all 24688

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>