0

I have to connect to many Foxpro databases that have a connection string like: Data Source=\\All Users\\DB0009\db1.dbc;User ID=xxx;Password=yyy;Provider=VFPOLEDB.1;Persist Security Info=True;

where the folder DB0009 can be any integer from 0000 to 0100 and the db1.dbc can be either db1.dbc or db2.dbc for each folder.

For each connection string, I need to build a simple SQL statement that is identical for every database except for a hardcoded year. So the sql is: select *, '2012' from table

I'd like to be able to store both the connection string AND the year for each connection string in a sql table that can be looked up at run time.

I am using SSIS 2008. I'm guessing based on what i've seen that i can use the foreach loop with the enumerator set as the ADO Enumerator (though i wouldn't mind confirmation there), but how can i pull the year off of that same table and put it into the sql query i have inside a data flow task?

Thanks for any help! Kary

1
  • The desire is to create an authoritative list of all the available connection strings and associate a value with that connection string? Commented Feb 1, 2012 at 15:50

1 Answer 1

2

You could do the following steps:

  1. Create the foreach loop to get the connection string and year values into variables.
  2. create a connection manager and, using an expression, set the connection string property to your connection string variable.
  3. Create another variable with an expression that creates your SQL command with the year variable (dynamic SQL command string).
  4. use the execute SQL task to execute this within your foreach.

Here's a link to a blog on mapping the parameter inside the Execute SQL Task that should be helpful. http://www.rafael-salas.com/2007/11/ssis-mapping-parameter-inside-of.html

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.