October 28, 2009 at 8:21 am
I have a flat file connection manager, set to a test file, and a flat file source that reads this file into a database.
What I want to do is query a database table first and get the path and filename of the text file I want to load; then I want to set the connection manager connectionstring/source to the filename I just read from the database. It sounds like I can programmatically access the flat file connection manager, but I don't see where - my flat file source feeds into a script component, and at that time it's too late to modify the source. Is there a code behind or "on start" even or something somewhere in the SSIS package? In the event handlers, I only have OnError listed for my dataflow objects.
I could probably add a new data flow step that loads a variable with the filename, but I still don't see where I could read that variable in and set the connection manager source before it proceeds through the rest of the data flow. Help?
October 28, 2009 at 8:36 am
Pete T-366679 (10/28/2009)
I have a flat file connection manager, set to a test file, and a flat file source that reads this file into a database.What I want to do is query a database table first and get the path and filename of the text file I want to load; then I want to set the connection manager connectionstring/source to the filename I just read from the database. It sounds like I can programmatically access the flat file connection manager, but I don't see where - my flat file source feeds into a script component, and at that time it's too late to modify the source. Is there a code behind or "on start" even or something somewhere in the SSIS package? In the event handlers, I only have OnError listed for my dataflow objects.
I could probably add a new data flow step that loads a variable with the filename, but I still don't see where I could read that variable in and set the connection manager source before it proceeds through the rest of the data flow. Help?
Pete,
What you have to do is setup the values you load from the database into package variables. And then you have to use these variables in expression, which sets the flat file connection manager properties dynamically.
October 28, 2009 at 8:46 am
Nice, I'll try that out. What is the expression syntax? I would just integrate that into the source dialog in the connection manager properties?
I was just starting to try a Script Task prior to my data flow that would select from the db and either set the connection property directly, or like you suggest, set a package variable.
Thanks!
October 28, 2009 at 9:00 am
Pete T-366679 (10/28/2009)
Nice, I'll try that out. What is the expression syntax? I would just integrate that into the source dialog in the connection manager properties?I was just starting to try a Script Task prior to my data flow that would select from the db and either set the connection property directly, or like you suggest, set a package variable.
Thanks!
I would recommend you check this introduction to expressions by Andy Leonard. As always I would recommend you get a good book about SSIS. These two are some of the best:
October 28, 2009 at 10:20 am
CozyRoc (10/28/2009)
...
These two are one of the best:
...
Hmmm, you might be pretty good at SSIS, but I'm not so sure about your English! 😀
The absence of evidence is not evidence of absence.
Martin Rees
You can lead a horse to water, but a pencil must be lead.
Stan Laurel
October 28, 2009 at 10:27 am
Phil Parkin (10/28/2009)
CozyRoc (10/28/2009)
...
These two are one of the best:
...
Hmmm, you might be pretty good at SSIS, but I'm not so sure about your English! 😀
Thank you for the friendly correction Phil 😉 As English is not my native language, I'm doing my best.
October 28, 2009 at 10:33 am
I hope you did not take offence - none was intended. My comment was meant in fun.
I never even suspected that English was not your native language - you write so fluently.
Phil
The absence of evidence is not evidence of absence.
Martin Rees
You can lead a horse to water, but a pencil must be lead.
Stan Laurel
October 28, 2009 at 10:42 am
Phil Parkin (10/28/2009)
I hope you did not take offence - none was intended. My comment was meant in fun.I never even suspected that English was not your native language - you write so fluently.
Phil
Thank you for the kind words. And of course I did understand your intention. I know you are a nice guy.
October 28, 2009 at 3:58 pm
Thanks everyone for all the help! That actually seems to work quite well, and I've got my package working the way I need it. Thanks again!
Viewing 9 posts - 1 through 8 (of 8 total)
You must be logged in to reply to this topic. Login to reply