• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2935
  • Last Modified:

How do I Loop Through a full resultset SQL Task and Execute storedprocedure

How do I loop through a full result set returned from SQL task and use the two output parameters returned to pass into a stored procedure. Thanks
0
encoredatas
Asked:
encoredatas
  • 2
  • 2
1 Solution
 
HoggZillaCommented:
Sure.
You need to save the resultset to an Object variable. Create 2 other variables to hold your column data. Connect the Execute SQL Task to a Foreach Loop Container. Choose Foreach ADO Enumerator. Set the Obect source variable to your recordset variable. Choose rows in the first table. Under variable mappings map the column variables to index 0 and 1, assuming the recordset's first two columns are the ones you want.
Now you have it, a loop over those two values.
0
 
encoredatasAuthor Commented:
Do I drag the New SQL Task that executes. The stored procedure using the Output variables inside the Foreach Loop Container. I have done this and  I don't seem to see it executing the stored procedure inside the Loop Container.  
0
 
HoggZillaCommented:
Yes, put the Execute SQL Task for the stored proc inside the Foreach Loop container. Use a script task to verify your variables are populated as expected.
Here is a screen shot.

recordset.bmp
0
 
encoredatasAuthor Commented:
Thanks so much. I'm starting to understand this stuff now.  Can you please look at the second part of this question which is part of the same ssis package titled. Thanks a million!!

"How do I Execute stored procedure and  if true(1) is returned Execute another stored procedure"
0
 
ken hanseCommented:
I am interesting about the learning SSIS packeges. and i'll testing sample on my system.
I like to see the actual files for me to test on my enviroment.

Thank for your help.

Regards,
Manjula
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Microsoft Office 2010

This course will introduce you to the interfaces and features of Microsoft Office 2010 Word, Excel, PowerPoint, Outlook, and Access. You will learn about the features that are shared between all products in the Office suite, as well as the new features that are product specific.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now