|
|
|
Grasshopper
      
Group: General Forum Members
Last Login: Thursday, March 10, 2011 1:45 PM
Points: 11,
Visits: 46
|
|
That worked for me. I was able to figure out where I'm doing wrong.
Thanks, Prasad
|
|
|
|
|
SSC Eights!
      
Group: General Forum Members
Last Login: Wednesday, May 22, 2013 1:30 AM
Points: 803,
Visits: 2,124
|
|
Firstly I wouldnt use a Script task they ar quite slow and can have problems on 64bit machines if they arnt precompiled.
I would use an Execute SQL task to get the data set and assign it to a Variable of Type Object.
You can then use the For Each ADO enumerator to parse the Each element of Object Variable into a New Variable using the Variable Mapping section of the Loop Column 1 in the record set = Index 0 on the mappnig (Column 2= 1, and so on).
_________________________________________________________________________ SSC Guide to Posting and Best Practices
|
|
|
|
|
Old Hand
      
Group: General Forum Members
Last Login: Tuesday, March 26, 2013 3:14 AM
Points: 345,
Visits: 503
|
|
^^ Correct.
Also you wouldn't want to hardcode something like database names in the script task - as new databases may be added or dropped.. 
-- Sabya
|
|
|
|
|
SSC-Dedicated
           
Group: General Forum Members
Last Login: Yesterday @ 7:36 PM
Points: 32,931,
Visits: 26,820
|
|
Heh... I probably wouldn't use SSIS for such a thing. I damned sure wouldn't use a script for this. T-SQL would do the job just fine.
--Jeff Moden "RBAR is pronounced "ree-bar" and is a "Modenism" for "Row-By-Agonizing-Row".
First step towards the paradigm shift of writing Set Based code: Stop thinking about what you want to do to a row... think, instead, of what you want to do to a column."
For better, quicker answers on T-SQL questions, click on the following... http://www.sqlservercentral.com/articles/Best+Practices/61537/
For better answers on performance questions, click on the following... http://www.sqlservercentral.com/articles/SQLServerCentral/66909/
|
|
|
|
|
SSCarpal Tunnel
       
Group: General Forum Members
Last Login: Today @ 2:53 AM
Points: 4,247,
Visits: 9,501
|
|
Jeff Moden (12/22/2009) Heh... I probably wouldn't use SSIS for such a thing. I damned sure wouldn't use a script for this. T-SQL would do the job just fine.
So ... what would you use SSIS for Jeff?
____________________________________________________________________________________________
Help us to help you. For better, quicker and more focused answers to your questions, consider following the advice in this link:
http://www.sqlservercentral.com/articles/Best+Practices/61537/
If you are asking for help and your post does not contain a question, you should expect responses which do not contain any answers. Put a question mark in there somewhere - it's not rocket science.
|
|
|
|
|
Grasshopper
      
Group: General Forum Members
Last Login: Thursday, March 10, 2011 1:45 PM
Points: 11,
Visits: 46
|
|
Jeff Moden (12/22/2009) Heh... I probably wouldn't use SSIS for such a thing. I damned sure wouldn't use a script for this. T-SQL would do the job just fine.
Hi Jeff,
I'm new to SSIS and I'm trying to see how I can use the foreach loop container in big scheme of things. This is a part of the package and package does have multiple data flow tasks in it besides the foreach loop container.
Thanks, Prasad
|
|
|
|
|
Grasshopper
      
Group: General Forum Members
Last Login: Thursday, March 10, 2011 1:45 PM
Points: 11,
Visits: 46
|
|
sabyasm (12/22/2009)
^^ Correct.
Also you wouldn't want to hardcode something like database names in the script task - as new databases may be added or dropped.. 
Hi Sabyasm,
Good point. I'm not retreving and hardcoding the database names. I'm just gettng the names of the feeds we do run at work and those are configured by our team 
Thanks, Prasad
|
|
|
|
|
Forum Newbie
      
Group: General Forum Members
Last Login: Friday, February 25, 2011 2:34 AM
Points: 5,
Visits: 22
|
|
- Set up a variable to hold the Array. This must be a System.Object type variable. - Set up a variable to hold the current array value. The must be a String. - Set the array up like this;
Dim sourceTabs() As String sourceTabs = "Sheet1$,Sheet2$".Split(",")
- Set the loop up using the above variables - Voila!
(The example above was used to iterate through a fixed list of Excel tabs which were then used as data sources.)
The crucial part was to set up the object as an Array, rather than an ArrayList.
Stu
|
|
|
|
|
SSC-Dedicated
           
Group: General Forum Members
Last Login: Yesterday @ 7:36 PM
Points: 32,931,
Visits: 26,820
|
|
Phil Parkin (12/23/2009)
Jeff Moden (12/22/2009) Heh... I probably wouldn't use SSIS for such a thing. I damned sure wouldn't use a script for this. T-SQL would do the job just fine.So ... what would you use SSIS for Jeff? 
Heh... (counting my lucky stars as I speak)... "nothing" is all I can come up with, so far.
--Jeff Moden "RBAR is pronounced "ree-bar" and is a "Modenism" for "Row-By-Agonizing-Row".
First step towards the paradigm shift of writing Set Based code: Stop thinking about what you want to do to a row... think, instead, of what you want to do to a column."
For better, quicker answers on T-SQL questions, click on the following... http://www.sqlservercentral.com/articles/Best+Practices/61537/
For better answers on performance questions, click on the following... http://www.sqlservercentral.com/articles/SQLServerCentral/66909/
|
|
|
|
|
SSC Rookie
      
Group: General Forum Members
Last Login: Friday, January 18, 2013 4:51 PM
Points: 37,
Visits: 329
|
|
|
|
|