不同的 RAISERROR 严重性级别是什么意思? [英] What do the different RAISERROR severity levels mean?
问题描述
我最好的谷歌搜索结果是这个:
My best google result was this:
- 低于 11 的是警告,而不是错误
- 11-16 可用
- 超过 16 个是系统错误
- 11-16 岁之间没有行为差异
但是,在 BOL 中,任何用户都可以指定从 0 到 18 的严重级别."
But, from BOL, "Severity levels from 0 through 18 can be specified by any user."
在我的特定存储过程中,我希望将错误返回给 .Net 客户端应用程序,因此看起来 11-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?
推荐答案
您应该返回 16.是默认的、最常用的错误级别:
You should return 16. Is the default, most used error level:
表示可能出现的一般错误由用户更正.
Indicates general errors that can be corrected by the user.
不要返回 17-18,那些表示更严重的错误,比如资源问题:
Don't return 17-18, those indicate more severe errors, like resource problems:
表示不能的软件错误由用户修正.通知您的问题的系统管理员.
Indicate software errors that cannot be corrected by the user. Inform your system administrator of the problem.
也不要返回 11-15,因为每个级别都有一个特殊的含义(14 - 安全访问,15 - 语法错误,13 - 死锁等).
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).
级别 16 不会终止执行.
Level 16 does not terminate execution.
如果您打算记录警告但继续执行,请改用低于 10 的严重性级别.
When your intention is to log a warning but continue execution, use a severity level below 10 instead.
这篇关于不同的 RAISERROR 严重性级别是什么意思?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!