locked
SSIS OnPostExecute Event handler firing before OnError event handler RRS feed

  • Question

  • Hi,

    I have an SSIS package with OnPostExecute  and OnError event handler. For some reasons OnPostExecute  is firing before OnError. (The progress window confirms that and I also tested with a messagebox)
    Is it suppose to work like that?
    I am new to ssis and so I might be doing something wrong. please help

    Thanks

    Swamy

    Thursday, July 4, 2013 4:59 PM

Answers

  • Hi Swamy,

    If you want to collect errors associated with the data flow task, I would suggest having a similar error handler associated with the data flow executable.

    Whether the package error handler for the package fires or not depends on how errors from the data flow(s) are being propagated to the package. For instance, if all errors are redirected or ignored in the data flow (which I think is technically possible), no errors will be propagated.


    Kind regards M

    • Proposed as answer by Mike Yin Monday, July 8, 2013 11:11 AM
    • Marked as answer by Mike Yin Thursday, July 11, 2013 5:08 PM
    Friday, July 5, 2013 10:36 AM

All replies

  • yes, the order must OnError 1st, you also may be seeing two OnPostExecutes, and only one after the OnError.

    It would be useful if you could share the design of the package here I think.


    Arthur My Blog

    Thursday, July 4, 2013 6:28 PM
  • Thanks Arthurz,

    I noticed on a successful run the postexecute is fired twice and when there is error, post execute is only fired once and then OnError fires. I have provided few screenshots of a successful run





     I have to set delay validation true to all tasks?

    I think once OnError is fired the program stops without firing OnPostExecute. Please helphanks,

    Swamy

    Friday, July 5, 2013 8:50 AM
  • Hi Swamy,

    Are your Event Handlers supposed to be associated with the Data flow executable or with something else?

    Looking at your screenshot, both your data flow executable appear to be called "Data Flow Task 1" but your Event Handlers are associated with an executable called ImportVEMPDTA_IAM which I suspect is not the data flow but the package.


    Kind regards M

    Friday, July 5, 2013 9:38 AM
  • Hi M Vega,

    Thanks, You are correct.

    The ImportVEMPDTA_IAM is my package and I have a single Data Flow Task. The events are associated with the package and not with the Data flow Task. My goal is to collect all errors and email at one shot. So I chose to associate with package.  

    I am still learning and I understood that OnPostExecute will be called by each executable, so in my case it is called twice, one for Package and one for Data Flow task.  As there is no OnPostExecute for data flow task I think it bubbled up to the parent containers event.  Is my understanding correct?.

    Also suggest me on how to achieve sending all errors in one shot. I.e., going forward I will have more data flow task and I just want to fire only one email at the end. So which event or approach should I use.

    Thanks,

    Swamy

    Friday, July 5, 2013 10:27 AM
  • Hi Swamy,

    If you want to collect errors associated with the data flow task, I would suggest having a similar error handler associated with the data flow executable.

    Whether the package error handler for the package fires or not depends on how errors from the data flow(s) are being propagated to the package. For instance, if all errors are redirected or ignored in the data flow (which I think is technically possible), no errors will be propagated.


    Kind regards M

    • Proposed as answer by Mike Yin Monday, July 8, 2013 11:11 AM
    • Marked as answer by Mike Yin Thursday, July 11, 2013 5:08 PM
    Friday, July 5, 2013 10:36 AM