我正在尝试测试一些在 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.
有没有办法在没有实际设置导致错误的情况的情况下引发这样的任意错误?