SSIS package fails within data flow task - how to handle error?

  • I have an SSIS package that is a simple dataflow task. I have a mail task off the data flow task as a "failure" task to email me if the dataflow fails. The dataflow consists of a flat-file source to an OLEDB destination. If I delete the input file and run the package the dataflow task "fails" but never goes to the mail task. If I open the dataflow task the flat-file source is red and that's it. In the Progress window it says the flat-file source component failed in pre-execute.

    Other than adding a step prior to the dataflow to check for the file and email if it is missing, is there a way to get the dataflow task to fail and just fall through to the failure mail task in the package?

     

  • Do you have the FailPackageOnFailure property of the dataflow task set to false?

    Jack Corbett
    Consultant - Straight Path Solutions
    Check out these links on how to get faster and more accurate answers:
    Forum Etiquette: How to post data/code on a forum to get the best help
    Need an Answer? Actually, No ... You Need a Question

  • How about creating an OnError event and placing the mail task here. This what I do to notify me when a package has failed.

  • Jack Corbett (5/22/2009)


    Do you have the FailPackageOnFailure property of the dataflow task set to false?

    Yep

     

  • andrew.roberts (5/24/2009)


    How about creating an OnError event and placing the mail task here. This what I do to notify me when a package has failed.

    We're looking at this but we were hoping there was a less code-intensive way...

     

  • That is the less code intensive way.

    Click on Event Handlers then on the link that says 'Click here to create an 'OnError' event handler

    Drag a send mail task onto the form

    Configure the mail task

  • Can you tell in the event handler what the error is? It would be nice if I could include the error in the email text...

     

  • I haven't done this myself has I normally put a generic message in the e-mail. But just had a quick look give this a try and see how you get on.

    Set the mail task up with a SMTP connection, a from and to email address.

    Under Expressions click on the ellipses

    Under property select MessageSource

    Under the Expression click on the ellipses

    From the variables drag in System::ErrorDescription

  • Thanks, will try that.

     

  • I don't think that will work because if its failing in the pre-execute phase, then its not executing (logically), therefore there will be no event triggered because of the failure.

    I'd add a script task that checks for the file, if the file does not exist, then change a boolean variable to false. Add another script task and set the result to value of the variable - from there, you can have your sendmail task.

  • niall.baird (5/27/2009)


    I don't think that will work because if its failing in the pre-execute phase, then its not executing (logically), therefore there will be no event triggered because of the failure.

    I'd add a script task that checks for the file, if the file does not exist, then change a boolean variable to false. Add another script task and set the result to value of the variable - from there, you can have your sendmail task.

    We added the OnError code just as a catch-all but we also added a script task before the DataFlow to check for the file. I knew I could do it that way, I was hoping there was a way to make the DataFlow task pass the failure on to the Mail task that was wired to it on a Failure precedent.

     

Viewing 11 posts - 1 through 10 (of 10 total)

You must be logged in to reply to this topic. Login to reply