(ADF V2) ForEach Activity - How to BREAK out of the loop Upon 1st Failure Encountered


  • I am iterating over 90 stored procedures.  Let's say the 2nd stored procedure fails. I need to stop iterating immediately.

    I am making it sort of work by using an If Condition activity inside the ForEach activity to check the previous stored proc's execution status (from a sql log table that I populate for each sp that executes). For example:

    ForEach   (iterates over 90 sp's)

       If Condition (checks for error in previous stored proc execution)

           Error is False: Execute the current item().StoredProcedure

           Error is True:  Do nothing.   

       Fetch next item().StoredProcedure

    So, although, I am not executing any stored procs after the 1st failure, my loop continues and it is a waste of time.  

    How can I break out of the loop?

    • Edited by zl34 Sunday, July 8, 2018 6:25 PM
    Sunday, July 8, 2018 1:42 PM

All replies