Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Question on how to dynamically change the 'FileConnection' property durning runtime in SSIS Expand / Collapse
Author
Message
Posted Tuesday, February 26, 2013 11:46 AM
Valued Member

Valued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued Member

Group: General Forum Members
Last Login: 2 days ago @ 8:27 AM
Points: 65, Visits: 406
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.
Post #1424204
Posted Tuesday, February 26, 2013 1:07 PM
Mr or Mrs. 500

Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500

Group: General Forum Members
Last Login: Monday, September 22, 2014 12:41 PM
Points: 544, Visits: 1,053
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.
Post #1424230
Posted Tuesday, February 26, 2013 1:48 PM
Valued Member

Valued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued Member

Group: General Forum Members
Last Login: 2 days ago @ 8:27 AM
Points: 65, Visits: 406
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?
Post #1424242
Posted Tuesday, February 26, 2013 2:56 PM
Mr or Mrs. 500

Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500

Group: General Forum Members
Last Login: Monday, September 22, 2014 12:41 PM
Points: 544, Visits: 1,053
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.

Post #1424257
Posted Tuesday, February 26, 2013 3:47 PM
Mr or Mrs. 500

Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500

Group: General Forum Members
Last Login: Thursday, September 18, 2014 1:52 PM
Points: 504, Visits: 1,870
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.
Post #1424269
Posted Wednesday, February 27, 2013 6:41 AM
Valued Member

Valued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued Member

Group: General Forum Members
Last Login: 2 days ago @ 8:27 AM
Points: 65, Visits: 406
Thank you both for your replies! SSIS is not my stregth as I'm a DBA so this information is much appreciated.
Post #1424502
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse