Last week while checking the logs of my sql servers I found the following errors on one of the developer’s servers:
Error: 18054, Severity: 16, State: 1.
Error 50001, severity 1, state 1 was raised, but no message with that error number was found in sys.messages. If error is larger than 50000, make sure the user-defined message is added using sp_addmessage.
I searched for few days without success. When I finally got the chance to ask the developer he replied the following:
“sometimes earlier during an upgrade or build, this went wrong
if not exists (select 1 from master..sysmessages where error = 50001)
print “sp_addmessage 50001, 1, “”rollback trigger with raiserror”””
if not exists (select 1 from master..sysmessages where error = 50002)
print “sp_addmessage 50002, 1, “”rollback trigger”””
That’s why the error appears, the messages can be added manually.”
I did found using Google that Message numbers from 50001 and up are user-defined. This I found on http://www.sommarskog.se/error-handling-I.html, so next time you see an error higher than 50000, you should remember that it is a user-defined error.