I'm iterating several years with a Dataflow inside a Foreach Loop, but there are some years that will not return any data, therefore they SSIS package fails, is there a way to handle this? To tell the package to ignore those blanks and keep executing?
Thanks,
One approach you can take if you don't want to touch how the data is being passed to the Foreach
component:
You may include an additional Execute SQL Task
component inside the Foreach
container that checks first if there is any data to process.
Create a variable to which your SQL task will set the record count to, for example @cntProceed
Set this component to run before your Dataflow task.
Modify the precedence constraint (green arrow from your SQL task to your Dataflow task). Set the evaluation operation
to Expression and Constraint
, Value
to Success
, and Expression
to @cntProceed != 0
What this all does: Inside the foreach component/container it will first check if there exists any data to work with. That's what the additional component will do, and if there's data to use, it will proceed to the dataflow component. Otherwise, that "each"
(or rather.. that one loop) will end and the Foreach
will move to the next.