Solved

For each loop container where  data comes from multiple columns in select from a SQL table

Posted on 2014-11-10
2
198 Views
Last Modified: 2014-11-11
I need to create an SSIS package that will create  files  where the file name contains the Date and time of all rows  that are selected from a SQL table.  I gather that I need to use a foreach loop container, and I Have three variables that hold Dte:  '1/2/2014' which is the date from the input table,  Hr:  15 which contains the hour of the day and Portion: 1 or 2 which designates if the activity occurred in the first half hour (1) or the second half hour.  
Do I need to generate a for each loop that for each Date then within that for each loop the hour of the day, then a third for each loop that designates the half hour or can I do I all in one For each loop?  

Can someone give me an idea of how to proceed?

Thanks
0
Comment
Question by:LenTompkins
2 Comments
 
LVL 24

Accepted Solution

by:
Phillip Burton earned 500 total points
ID: 40433107
Don't have it imported from an SQL table - import it from an SQL view which is based on the table.

In the view, add a separate field which combines the three fields into one date, similar to the filename you want to create. It should be a SELECT DISTINCT query, so each filename only comes up.

Then use that view as the source for your loop - see the article http://redmondmag.com/articles/2009/11/02/loop-thru-rows.aspx for more details.
0
 

Author Closing Comment

by:LenTompkins
ID: 40435038
I got it to work.  Thanks
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Apparent collision of square brackets in jQuery and Classic ASP 12 30
Event ID 10010 3 69
Need example 5 122
Why is "packages element is not declared"? 2 325
This article shows a few slightly more advanced techniques for Windows 7 gadget programming, including how to save and restore user settings for your gadget and how to populate the "details" panel that is displayed in the Windows 7 gadget gallery.  …
As more and more people are shifting to the latest .Net frameworks, the windows presentation framework is gaining importance by the day. Many people are now turning to WPF controls to provide a rich user experience. I have been using WPF controls fo…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

861 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question