Enables and disables the logging of a system-defined or user-defined message in the Adaptive Server error log.
sp_altermessage message_id, parameter, parameter_value
is the message number of the message to be altered. This is the number of the message as it is recorded in the error column in the sysmessages or sysusermessages system table.
is the message parameter to be altered. The maximum length is 30 bytes. The only valid parameter is with_log.
is the new value for the parameter specified in parameter. The maximum length is 5 bytes. Values are true and false.
Specifies that message number 2000 in sysmessages should be logged in the Adaptive Server error log and also in the Windows NT Event Log (if logging is enabled):
sp_altermessage 2000, 'with_log', 'TRUE'
If the parameter_value is true, the specified message is always logged. If it is false, the default logging behavior is used; the message may or may not be logged, depending on the severity of the error and other factors. Setting the parameter_value to false produces the same behavior that would occur if sp_altermessage had not been called.
On Windows NT servers, sp_altermessage also enables and disables logging in the Windows NT Event Log.
Only the Database Owner or a System Administrator can execute sp_altermessage.
System procedures sp_addmessage, sp_dropmessage