SSIS——允许任务失败但包成功? [英] SSIS -- Allow a task to fail but have the package succeed?

查看:28
本文介绍了SSIS——允许任务失败但包成功?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法允许脚本任务失败,而包执行结果只基于其他任务的执行结果?例如,我有 5 个任务.我不在乎任务 2 的结果是什么,但是如果其他任务中的任何一个失败,我希望包失败.否则,我希望它成功...

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...

这可能吗?

推荐答案

尝试在任务的属性中将 FailPackageOnFailure 设置为 False.

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

下一个选项实际上不会使您的任务失败,但可能对您有用:尝试将您的代码包装到 try catch 中,并使用 finally 为您不关心的 2 个任务设置 Success.

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;
        }

这篇关于SSIS——允许任务失败但包成功?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆