SSIS: Continue Looping After a Child Task Failure

It is a very common scenario that we want the loop to continue even in case of a child task failing. We can implement this in the following manner.

1.       Create your loop and configure it

http://2.bp.blogspot.com/-u1tw22SMUKc/Tp1Ot_OvhpI/AAAAAAAAAKs/O-ohiyd7yG4/s320/image002-751424.jpg

2.       Add a Sequence Container to that Loop

http://1.bp.blogspot.com/-GE7ABxi0mPQ/Tp1OuPMJA0I/AAAAAAAAAK4/deo_zOrJbII/s320/image004-752355.jpg

3.       Set the Sequence Container’s MaximumErrorCount Property To 0 (Zero)

http://3.bp.blogspot.com/-D6HMgdGbS_c/Tp1OuRx-WPI/AAAAAAAAALE/5hYeIbyZ_xE/s320/image011-753337.jpg

4.       Create an OnError Event Handler for the Sequence Container

http://4.bp.blogspot.com/-jKhnIpHD0nc/Tp1Oul7GE1I/AAAAAAAAALU/vih9zWgvFVo/s320/image013-754197.jpg

(You can create a custom error logging mechanism here)

http://4.bp.blogspot.com/-FbdBAXdjRz0/Tp1Ouxk1JMI/AAAAAAAAALc/l-hG9GYOyzQ/s320/image018-755621.jpg

5.       Set the system variable Propagate to False when in the Event Handler Page

http://1.bp.blogspot.com/--d5bm-kWYBc/Tp1OvA690oI/AAAAAAAAALo/a8zR2QcdZ0Y/s320/image020-756467.jpg

You can see the system variables by clicking the gray button on the Variables Window

http://2.bp.blogspot.com/-AS_CThwmmTc/Tp1OvQwh0vI/AAAAAAAAAL0/lum1LRG7Q3U/s320/image024-757493.jpg

6.       Add your Child Task in the Sequence Container

http://4.bp.blogspot.com/-LYmiSYoDhQs/Tp1OvrBOg6I/AAAAAAAAAMA/h8Ht-9RKERA/s320/image025-758650.jpg

In My case I have added a script task that is throwing a dummy Exception using

Throw New ApplicationException("Test Exception")

7.       Execute the package and done. The Script task will fail  but the Sequence container and the Loop Container will execute successfully

http://2.bp.blogspot.com/-JUZUW_iOYMY/Tp1Ov-B3TKI/AAAAAAAAAMQ/QY_rV920_E4/s320/image027-759653.jpg