Solved

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

Posted on 2014-11-10
2
186 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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

This article shows how to make a Windows 7 gadget that extends its U/I with a flyout panel -- a window that pops out next to the gadget.  The example gadget shows several additional techniques:  How to automatically resize a gadget or flyout panel t…
In this article, I will show how to use the Ribbon IDs Tool Window to assign the built-in Office icons to a ribbon button.  This tool will help us to find the OfficeImageId that corresponds to our desired built-in Office icon. The tool is part of…
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…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

744 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now