【发布时间】:2017-06-08 14:11:32
【问题描述】:
在我的 SSIS 脚本组件任务(不是脚本任务,它可以添加到控制流中,而是脚本组件任务,它添加到数据流中)中,我在 @ 的 catch 部分添加了一些错误处理987654324@块:
// No connection was created. Exit gracefully
bool cancelOnError = false;
ComponentMetaData.FireError(ErrorCode: 10, SubComponent: "SubComponent",
Description: "Couldn't set up the connection. This could be because an invalid host was
provided, or due to a firewall blocking the connection.", HelpFile: "", HelpContext: 0,
pbCancel: out cancelOnError);
这一切都很好,脚本任务捕获了我在代码中提出的错误。我还可以在日志中看到错误:
Error: 0xA at DFT Extract, SubComponent: Couldn't set up the connection.
This could be because an invalid host was provided, or due to a firewall
blocking the connection.
但是,任务上的图标是绿色的,并且我定义的用于处理结果的后续任务被触发(但没有什么要处理的,因为此特定错误发生在处理任何数据之前):
数据流正确显示了一个红十字图标。有什么方法可以更改脚本组件上的图标,或者有更好的方法让我(优雅地)模拟一个显示停止错误?
我找到了this page on Microsoft,显示了Script Task和Script Components的区别,其中还说明了:
脚本组件作为数据流任务的一部分运行,并不 使用这些属性之一报告结果。
这并没有让我很有希望,但我希望有人可以解决这个问题。我主要认为当我们捕获错误时显示绿色图标有点误导。
【问题讨论】:
标签: sql-server error-handling ssis etl