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

  • 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.

  • 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.

  • 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?

  • 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.

  • 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[/url]

    If you have multiple rows in your table and want to loop through each, this kind of approach will work.

  • Thank you both for your replies! SSIS is not my stregth as I'm a DBA so this information is much appreciated.

Viewing 6 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic. Login to reply