May 30, 2008 at 4:09 am
So what happens if I answered 3 but got it wrong, do I get the point still?
August 26, 2010 at 3:40 am
Another approach on dynamic connections by Hari Sharma on
http://sql-bi-dev.blogspot.com/2010/07/dynamic-database-connection-using-ssis.html#comment-form
October 31, 2012 at 11:40 am
Hi Kenneth,
I've tried the option of a foreach loop both with dataflows in the foreach loop and also with a second package however always seem to encounter the problem that it only queries the first result from the table (connection string stored here).
I've added a message box and can see the connection text changing however the actual connection doesn't change.
Am I missing something obvious?
Thanks,
Adam
October 31, 2012 at 1:46 pm
I would check and make sure your secondary package has a package configuration set up. It would need to be type "Parent Variable" and you can use it to change the servername (or database, or whatever) of your connection manager. These days I prefer to use expressions though. I've posted a quickie demo on my blog for you. Hope it helps.
Looping through multiple servers in SSIS[/url]
Kenneth FisherI was once offered a wizards hat but it got in the way of my dunce cap.--------------------------------------------------------------------------------For better, quicker answers on T-SQL questions, click on the following... http://www.sqlservercentral.com/articles/Best+Practices/61537/[/url]For better answers on performance questions, click on the following... http://www.sqlservercentral.com/articles/SQLServerCentral/66909/[/url]Link to my Blog Post --> www.SQLStudies.com[/url]
November 5, 2012 at 10:06 am
Hi Kenneth,
Thanks for the example however no joy with that either. Using either a table as the source or hard coding it into the FOREACH container doesn't appear to work. When it executes it runs without problems however only returns the results from the local machine. The servername changes to the ones in the list (using a message box) however when putting items into a table (using the @@servername for example) it's only the location machine being picked up.
I've tried setting the 'delayValidation' setting on and off but still no joy. Tried connecting to different servers but that hasn't helped either.
Any suggestions?
Thanks,
Adam
November 5, 2012 at 10:15 am
Ignore that comment Kenneth! Reason for no results was due to SQL Express not listing anything in sys.master_files so failing the query (and one of the engineers dropping ther other test machine I was using off the domain)! Will look into getting the dynamic part of this working now.
thanks again!
Adam
November 5, 2012 at 10:27 am
adam_pearson (11/5/2012)
Hi Kenneth,Thanks for the example however no joy with that either. Using either a table as the source or hard coding it into the FOREACH container doesn't appear to work. When it executes it runs without problems however only returns the results from the local machine. The servername changes to the ones in the list (using a message box) however when putting items into a table (using the @@servername for example) it's only the location machine being picked up.
I've tried setting the 'delayValidation' setting on and off but still no joy. Tried connecting to different servers but that hasn't helped either.
Any suggestions?
Thanks,
Adam
Just to confirm. You are using a FOR EACH loop, not a FOR loop. You have a variable mapped (under the variable mapping tab of the FOR EACH loop container) to store the output of the loop. You have an expression set up on the connection manager that you want to be changing and it uses the variable that you mapped in the FOR EACH loop. And last but not least is the code that you expect to have pointing to the new server inside the loop container?
If all that is true then see if you can walk through the setup on paper and post it to me. I would go ahead and use a Foreach Item Enumerator until you get it working since it has less moving parts to go wrong. Once we have that working then we can work on the next part.
Kenneth FisherI was once offered a wizards hat but it got in the way of my dunce cap.--------------------------------------------------------------------------------For better, quicker answers on T-SQL questions, click on the following... http://www.sqlservercentral.com/articles/Best+Practices/61537/[/url]For better answers on performance questions, click on the following... http://www.sqlservercentral.com/articles/SQLServerCentral/66909/[/url]Link to my Blog Post --> www.SQLStudies.com[/url]
Viewing 7 posts - 16 through 21 (of 21 total)
You must be logged in to reply to this topic. Login to reply