donderdag 16 augustus 2012

SSIS Foreach Loop Container stops after the first error.

Let's say you have a Foreach Loop Container looping thru all the employee records. For every record it does a few business logic checks, for some record you decide to throw an error and rollback the 'MS DTC' transaction to rollback eventually inserted or updated records. This error will be sent to the a Foreach Loop Container stopping it from selecting the next Employee record.




I have played around with FailPackageOnFailure, ForceExecutionValue and some other properties, none of them gave the result I wanted. I simply wanted the loop  to pick up the next Employee record and apply the same business logic.
The solution was adding an OnError Event handler to the Sequence container inside this Foreach Loop Container, then go to the variables and push the button to see the system variables and set the value for the Propagate variable to false



Now the error is no longer Propagated to the Foreach Loop Container. This means it will continue doing its work as expected

Geen opmerkingen:

Een reactie posten