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

LenTompkins
LenTompkins used Ask the Experts™
on
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
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Director, Practice Manager and Computing Consultant
Awarded 2014
Top Expert 2014
Commented:
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.

Author

Commented:
I got it to work.  Thanks

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial