Reputation: 1882
i have question related to Sending mail in Foreach LoopContainer which has nested another Foreach LoopContainer
Everything works fine (1. Select areas SQLTask
) selects distinct areas from database - it works fine. Startdate
, enddate
is used as time period in select - works fine.
1.st Foreach Loop Container
in Collection has ADO object source Variable Area, Enumeration mode Rows in First table. in Variable mappings is my Variable area
which is passed to Execute SQL Task.
Execute SQL Task - As SQL Query i have defined:
`select * from my table, where Date between start date and end date and area = ?`
Than it goes to nested Foreach Loop Container where is Script task - it works ok, it retrieves data which are sent via mail Task
.
My Problem is
I have for test purpose two areas - First loop sends only rows for first area, which is ok, but for second area SSIS gives me records for first and second area together. Where can be error? i retrieve two mails for two areas, it means parameter to first foreach loop container from first sql task looks good, but first mail has data for first area, second has record for first and second area.
Thanks in advance
Upvotes: 1
Views: 1276
Reputation: 4187
I suppose the script task is used in order to build the mail body or something? Is it stored in a Variable? What is in the expression of your Mail Task? Anyways, if you use a variable, you will have to dump it in each iteration - otherwise it wll be extended over and over as long as your loop is running.
Upvotes: 1