Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SSIS -- Allow a task to fail but have the package succeed?

Tags:

ssis

Is there a way to allow a script task to fail, yet have the package execution result based only on the other tasks' execution results? For example, I have 5 tasks. I don't care what task 2's result is, but if any of the others fail, I want the package to fail. Otherwise, I want it to succeed...

This possible?

like image 261
nosirrahcd Avatar asked Jan 10 '11 15:01

nosirrahcd


People also ask

How do I troubleshoot a failed SSIS package?

The main techniques for troubleshooting deployed packages are as follows: Catch and handle package errors by using event handlers. Capture bad data by using error outputs. Track the steps of package execution by using logging.

Which task can be used to execute a package inside one more package?

The Execute Package task can run child packages that are contained in the same project that contains the parent package.

How do I get an SSIS package error?

In the Solution Explorer, Right-click on the SSIS package and click on Execute. The Red-Cross icon on the execute SQL Task shows that the package execution failed. Click on the Progress tab for the detailed error message. By looking at the following screenshot, we can identify the error message.


2 Answers

As well as setting FailPackageOnFailure on the task you should also set MaximumErrorCount on the package itself to something greater than 1. The task will still increment the packages error count and if the error count exceeds MaximumErrorCount then the package can/will still fail.

like image 154
squillman Avatar answered Oct 19 '22 13:10

squillman


Try setting FailPackageOnFailure to False in the Task's Properties.

Next option will not actually fail your tasks, but may work for you: Try wrapping your code into try catch and use finally to set Success for 2 tasks that you don't care about.

        try
        {
           // Do work here 
        }
        catch
        {
            // log errors here
        }
        finally
        {
            Dts.TaskResult = (int)ScriptResults.Success;
        }
like image 43
Ilya Berdichevsky Avatar answered Oct 19 '22 13:10

Ilya Berdichevsky