不同的RAISERROR严重性级别意味着什么?

时间:2020-12-11 20:03:59

My best google result was this:

我最好的谷歌结果是:

  • below 11 are warnings, not errors
  • 下面是警告,而不是错误
  • 11-16 are available for use
  • 11-16可用
  • above 16 are system errors
  • 以上16个是系统错误
  • there is no behavioral difference among 11-16
  • 11-16之间没有行为差异

But, from BOL, "Severity levels from 0 through 18 can be specified by any user."

但是,从BOL中,“从0到18的严重程度可以由任何用户指定。”

In my particular stored procedure, I want the error returned to a .Net client application, so it looks like any severity level between 11-18 would do the trick. Does anyone have any authoritative information about what each of the levels mean, and how they should be used?

在我的特定存储过程中,我希望将错误返回到。net客户端应用程序中,因此在11-18之间的任何严重级别都可以实现这一目的。对于每个层次的含义以及它们应该如何使用,是否有人有任何权威的信息?

1 个解决方案

#1


93  

Database Engine Severity Levels

数据库引擎严重级别

You should return 16. Is the default, most used error level:

你应该返回16。为默认的、最常用的错误级别:

Indicates general errors that can be corrected by the user.

表示可由用户纠正的一般性错误。

Don't return 17-18, those indicate more severe errors, like resource problems:

不要返回17-18,这意味着更严重的错误,比如资源问题:

Indicate software errors that cannot be corrected by the user. Inform your system administrator of the problem.

指出用户无法纠正的软件错误。将问题通知系统管理员。

Also don't return 11-15 because those have a special meaning attached to each level (14 - security access, 15 - syntax error, 13 - deadlock etc).

也不要返回11-15,因为它们对每个级别都有特殊的意义(14 - security access, 15 -语法错误,13 - deadlock等等)。

Level 16 does not terminate execution.

16级不会终止执行。

When your intention is to log a warning but continue execution, use a severity level below 10 instead.

当您的意图是记录一个警告但继续执行时,使用低于10的严重性级别。

#1


93  

Database Engine Severity Levels

数据库引擎严重级别

You should return 16. Is the default, most used error level:

你应该返回16。为默认的、最常用的错误级别:

Indicates general errors that can be corrected by the user.

表示可由用户纠正的一般性错误。

Don't return 17-18, those indicate more severe errors, like resource problems:

不要返回17-18,这意味着更严重的错误,比如资源问题:

Indicate software errors that cannot be corrected by the user. Inform your system administrator of the problem.

指出用户无法纠正的软件错误。将问题通知系统管理员。

Also don't return 11-15 because those have a special meaning attached to each level (14 - security access, 15 - syntax error, 13 - deadlock etc).

也不要返回11-15,因为它们对每个级别都有特殊的意义(14 - security access, 15 -语法错误,13 - deadlock等等)。

Level 16 does not terminate execution.

16级不会终止执行。

When your intention is to log a warning but continue execution, use a severity level below 10 instead.

当您的意图是记录一个警告但继续执行时,使用低于10的严重性级别。