【发布时间】:2014-10-01 07:08:30
【问题描述】:
我正在尝试测试一些在 SQL Server 中捕获特定错误代码的代码。错误码是7886。
当我尝试THROW 时,我得到:
Error number 7886 in the THROW statement is outside the valid range. Specify an error number in the valid range of 50000 to 2147483647.
当我尝试RAISERROR 时,我得到:
Error number 7886 is invalid. The number must be from 13000 through 2147483647 and it cannot be 50000.
有什么方法可以引发这样的任意错误,而无需实际设置首先导致错误的情况?
【问题讨论】:
-
不,您不能在 T-SQL 中自己引发系统错误。
标签: sql sql-server throw raiserror