Please start any new threads on our new site at We've got lots of great SQL Server experts to answer whatever question you can come up with.

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

SQL Server Forums
Profile | Active Topics | Members | Search | Forum FAQ
Save Password
Forgot your Password?

 All Forums
 SQL Server 2008 Forums
 SSIS and Import/Export (2008)
 Need a Loop Within a Loop
 Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Constraint Violating Yak Guru

396 Posts

Posted - 10/02/2013 :  22:24:07  Show Profile  Reply with Quote
hi all,
This is what I need to do:

1. Loop thru table rows which contain folder names, full paths to files and store that path into a variable
2. In a ForEach Loop, FTP each file in that folder (this is already working but only for a hard-coded folder path)

Go back and read the next row to get the next folder name.

I'm looking for ways of adding the Outer Loop for Step 1.

Thanks for any ideas. Jack

Flowing Fount of Yak Knowledge

United Kingdom
3385 Posts

Posted - 10/03/2013 :  03:49:29  Show Profile  Visit nigelrivett's Homepage  Reply with Quote
Not sure what the problem is. Have a look at the for each item container. That allows a table as a source and place it in a variable.
Create a variable as a system object.
Create an execute sql task to get the full resultset from the table - just select the name. Under resultset set the resultset name to 0 and the variable to the one you have created.
That will populate the variable with the resultset.
Now create a for each loop with collection ADO enumerator and your object variable. Set the variable mapping to a string variable to get each value in turn.

That should give you a loop for each entry in the table.
I would then consider calling another package with that info to do the FTP using a variable with the path but that's up to you.

Cursors are useful if you don't know sql.
SSIS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page

Constraint Violating Yak Guru

396 Posts

Posted - 10/03/2013 :  08:35:03  Show Profile  Reply with Quote
Thanks for the ideas, Nigel. I will explore the ForEach Item loop.
Go to Top of Page
  Previous Topic Topic Next Topic  
 Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.02 seconds. Powered By: Snitz Forums 2000