Sql-server – How to disable Event log message about adhoc error message when using RaisError

sql serversql-server-2005windows-event-log

Some of the developers are using the following syntax in RaiseError:

RAISERROR('My business error message', 16, 0)

With the purpose of reusing the catch part of the try..catch block
for business error too.

But I spotted several event log entries like this:

Msg # 50006, <blabla> please register the error message with sp_addmessage

There's some way to disable the creation of such events? I searched google, msdn
and docs but didn't find a clue.

Best Answer

It means some other developers are using RAISERROR(50006, 16,1)... When the msgid syntax is used (or when the @local_variable in thesyntax is an int) the expectation is that the message was added to the local messages table. This is the normal approach for localized errors, to raiserror a msgid and add messages localized for various languages.

Whatever application/developer uses the msgid syntax, he/she is also responsible to add the message to the messages table during deployment, for the locale of the server.