Solved

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

Posted on 2014-11-10
2
210 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering 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

If you have ever found yourself doing a repetitive action with the mouse and keyboard, and if you have even a little programming experience, there is a good chance that you can use a text editor to whip together a sort of macro to automate the proce…
With most software applications trying to cater to multiple user needs nowadays, the focus is to make them as configurable as possible. For e.g., when creating Silverlight applications which will connect to WCF services, the service end point usuall…
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…
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…

626 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