Set Connection of OLE DB Source component at run-time in a script
Hello, Is it possible to set the Connection property of an OLE DB Source component at run-time using a script task? The Connection Manager exists at design time but based on different development/production databases, I need to set which connection manager should be used for the OLE DB source at rum time. If possible, how do I accomplish this? (Visual Studio 2005) Thanks.
May 17th, 2011 1:00pm

Check these: http://sql-bi-dev.blogspot.com/2010/07/dynamic-database-connection-using-ssis.htmllatha
Free Windows Admin Tool Kit Click here and download it now
May 17th, 2011 1:05pm

Thank you for the link. For the particular case that I was asking, I already have the Connection Managers at design time. Instead of needing to set their ConnectionString properties, I need to set the OLE DB Source's Connection property to one of the two Connection Managers based on a variable value. I cannot change the ConnectionString of the connection manager because both existing connection managers are used by other tasks in the package. For example, I have 10 tasks; 9 of the 10 use connection manager cmSource for the source component, and connection manager cmDest for the destination component. However, depending on whether it is development or produciton, the 10th task will use cmSource for both the source and destination component. Production will not change for this 10th task.
May 17th, 2011 1:47pm

Why do you need a script to accomplish a conn string substitution? Why not to set its value to a variable that will be expression driven? Example: http://consultingblogs.emc.com/jamiethomson/archive/2006/03/11/SSIS-Nugget_3A00_-Setting-expressions.aspx Tip: An expression can contain another variable in it.Arthur My Blog
Free Windows Admin Tool Kit Click here and download it now
May 17th, 2011 2:22pm

Thank you, but I do not see an Expressions property of the OLE DB Source component. That is what I originally wanted to do. What am i missing?
May 17th, 2011 3:21pm

Click to select your OLEDB connection manager and hit F4. In the properties window find Expressions and lick on the ellipses. You will be presented with a Property Expression window in which you can drop down on the left the ConnectionString part of the OLEDB conn manager property expression and assign it a variable.Arthur My Blog
Free Windows Admin Tool Kit Click here and download it now
May 17th, 2011 4:44pm

I need to set a value on the OLE DB Source component, not the OLE DB Connection Manager. Is that possible?
May 19th, 2011 8:57am

I need to set a value on the OLE DB Source component, not the OLE DB Connection Manager. Is that possible? No, it is not possible. You have to make the connection manager dynamic as other people have already recommended.SSIS Tasks Components Scripts Services | http://www.cozyroc.com/
Free Windows Admin Tool Kit Click here and download it now
May 20th, 2011 8:29am

Thank you for the clarification.
May 20th, 2011 8:34am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics