sp_altermessage

Enables and disables the logging of a system-defined or user-defined message in the SAP ASE error log.

Syntax

sp_altermessage message_id, parameter, parameter_value

Parameters

Examples

Usage

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 servers, sp_altermessage also enables and disables logging in the Windows Event Log.

Permissions

The permission checks for sp_altermessage differ based on your granular permissions settings.

SettingDescription
Enabled

With granular permissions enabled, you must be the database owner or a user with own database privilege.

Disabled

With granular permissions disabled, you must be the database owner or a user with sa_role.

Auditing

Values in event and extrainfo columns from the sysaudits table are:

InformationValues
Event

38

Audit option

exec_procedure

Command or access audited

Execution of a procedure

Information in extrainfo
  • Roles – Current active roles

  • Keywords or options – NULL

  • Previous value – NULL

  • Current value – NULL

  • Other information – All input parameters

  • Proxy information – Original login name, if set proxy in effect

Related reference
sp_addmessage
sp_dropmessage