Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

THROW or RAISERROR for specific non-user defined error codes

I'm trying to test some code that traps a specific error code in SQL server. The error code is 7886.

When I try to THROW, I get:

Error number 7886 in the THROW statement is outside the valid range. Specify an error number in the valid range of 50000 to 2147483647.

When I try to RAISERROR, I get:

Error number 7886 is invalid. The number must be from 13000 through 2147483647 and it cannot be 50000.

Is there any way to raise an arbitrary error like this without actually setting up the situation to cause the error in the first place?

like image 749
MushinNoShin Avatar asked Jun 07 '26 00:06

MushinNoShin


1 Answers

As said in the comments of the original question, this is impossible to do in SQL server.

:(

like image 54
MushinNoShin Avatar answered Jun 10 '26 10:06

MushinNoShin



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!