July 1, 2013 at 7:17 am
As per the subject really, though this is SSIS 2008.
I have an Execute SQL task followed by a Foreach Loop Container. The Execute SQL task returns a single column of values I wish to loop over in my Foreach Loop Container.
In the Execute SQL task I have set the Result Name to 0 and the Variable Name to my User variable (User::File_List) (of type Object).
In the Foreach Loop Container I have set the Enumerator to 'Foreach ADO Enumerator' and in the enumerator configuration I have set the ADO object source variable to the File_List variable. The enumeration mode is set to 'Rows in the first table', and in the variable mappings I have set another User variable named User::FileName, of type String. The Index is set to 0.
Within the Foreach Loop Container, I have a Script Task followed by a Data Flow Task.
When I run the script, the first iteration of the Foreach Loop container works perfectly. The Script Task takes the first value from the Foreach iteration and uses it to update another variable, then my Data Flow Task runs and uses that variable. On subsequent iterations, the Script Task is not executed, but the Data Flow Task is. Breakpoints added within the Script Task are not hit after the first iteration, and inspecting values using a breakpoint on the Data Flow Task shows that the Script Task does not get run.
What on earth is going on here? Is this a known bug or am I missing something?
Thanks,
Craig
July 1, 2013 at 8:07 am
Okay, ignore me, I've got to the bottom of it.
The Script Task contained a String.Format, which used a variable value as the format. This needed to be reset back to the format string before the next loop.
In terms of SSIS, the only bug is that the Script Task does not appear hit the OnPreExecute breakpoint each time through the loop.
It's going to be a long week...
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply