SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Question on how to dynamically change the 'FileConnection' property durning runtime in SSIS


Question on how to dynamically change the 'FileConnection' property durning runtime in SSIS

Author
Message
PFlorenzano-641896
PFlorenzano-641896
Old Hand
Old Hand (384 reputation)Old Hand (384 reputation)Old Hand (384 reputation)Old Hand (384 reputation)Old Hand (384 reputation)Old Hand (384 reputation)Old Hand (384 reputation)Old Hand (384 reputation)

Group: General Forum Members
Points: 384 Visits: 586
Hello,

I have an SSIS package with a number of File Connection Managers. These connection managers execute SQL scripts using Execute SQL Task. The way the package currently works is, the user has to explicitly open the SSIS package and make the FileConnection change, save the package, then run it.

I'm trying to figure out how to dynamically change this outside the package. I know I can use variables for this, but how can I pass a variable to the FileConnection property during run time?

Thank you for your time.
Erin Ramsay
Erin Ramsay
SSCrazy
SSCrazy (2.3K reputation)SSCrazy (2.3K reputation)SSCrazy (2.3K reputation)SSCrazy (2.3K reputation)SSCrazy (2.3K reputation)SSCrazy (2.3K reputation)SSCrazy (2.3K reputation)SSCrazy (2.3K reputation)

Group: General Forum Members
Points: 2253 Visits: 1119
What I've done in the past is used a table to read the filenames and paths that I wanted to import and then used that table/column combination to assign variables inside the application to modify the connection parameters.
PFlorenzano-641896
PFlorenzano-641896
Old Hand
Old Hand (384 reputation)Old Hand (384 reputation)Old Hand (384 reputation)Old Hand (384 reputation)Old Hand (384 reputation)Old Hand (384 reputation)Old Hand (384 reputation)Old Hand (384 reputation)

Group: General Forum Members
Points: 384 Visits: 586
Erin Ramsay (2/26/2013)
What I've done in the past is used a table to read the filenames and paths that I wanted to import and then used that table/column combination to assign variables inside the application to modify the connection parameters.


Thank you for the reply Erin. I created two separate tables, one for database connections and the other for file connections which has both files and paths loaded. Further, I created two new variables named DatabaseConnectionName and ScriptConnectionName.

So my question is this, how would I pass the contents from these tables, to the SSIS package with these variables?
Erin Ramsay
Erin Ramsay
SSCrazy
SSCrazy (2.3K reputation)SSCrazy (2.3K reputation)SSCrazy (2.3K reputation)SSCrazy (2.3K reputation)SSCrazy (2.3K reputation)SSCrazy (2.3K reputation)SSCrazy (2.3K reputation)SSCrazy (2.3K reputation)

Group: General Forum Members
Points: 2253 Visits: 1119
You don't actually pass them to the SSIS packet from outside. You have the SSIS packet pull the information from those table from inside the package itself. You can use a rowset to read the tables and pass that to a, if I remember correctly, ForEach container which in turn encapsulates all your other SSIS tasks so each task has access to the variables for the file names.
kl25
kl25
Ten Centuries
Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)

Group: General Forum Members
Points: 1178 Visits: 1875
Here an article by Andy Leonard that demonstrate how to put data from a result set into variables.

Object Variables, ResultsSets, and Foreach Loop Containers

If you have multiple rows in your table and want to loop through each, this kind of approach will work.
PFlorenzano-641896
PFlorenzano-641896
Old Hand
Old Hand (384 reputation)Old Hand (384 reputation)Old Hand (384 reputation)Old Hand (384 reputation)Old Hand (384 reputation)Old Hand (384 reputation)Old Hand (384 reputation)Old Hand (384 reputation)

Group: General Forum Members
Points: 384 Visits: 586
Thank you both for your replies! SSIS is not my stregth as I'm a DBA so this information is much appreciated.
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search