Peristiwa
31 Mac, 11 PTG - 2 Apr, 11 PTG
Acara pembelajaran SQL, Fabric dan Power BI terbesar. 31 Mac - 2 April. Gunakan kod FABINSIDER untuk menjimatkan $400.
Daftar hari iniPelayar ini tidak lagi disokong.
Naik taraf kepada Microsoft Edge untuk memanfaatkan ciri, kemas kini keselamatan dan sokongan teknikal yang terkini.
Applies to:
SQL Server
Alters the state of user-defined or system messages in an instance of the SQL Server Database Engine. User-defined messages can be viewed using the sys.messages
catalog view.
Transact-SQL syntax conventions
sp_altermessage
[ @message_id = ] message_id
, [ @parameter = ] N'parameter'
, [ @parameter_value = ] 'parameter_value'
[ ; ]
The error number of the message to alter from sys.messages
. @message_id is int, with no default.
Used with @parameter_value to indicate that the message is to be written to the Windows application log. @parameter is sysname, with no default.
@parameter must be set to WITH_LOG
or NULL
. If @parameter is set to WITH_LOG
or NULL
, and the value for @parameter_value is true
, the message is written to the Windows application log. If @parameter is set to WITH_LOG
or NULL
and the value for @parameter_value is false
, the message isn't always written to the Windows application log, but might be written depending upon how the error was raised.
If a message is written to the Windows application log, it is also written to the Database Engine error log file.
If @parameter is specified, @parameter_value must also be specified.
Used with @parameter to indicate that the error is to be written to the Windows application log. @parameter_value is varchar(5), with no default.
true
, the error is always written to the Windows application log.false
, the error isn't always written to the Windows application log, but might be written depending upon how the error was raised.If @parameter_value is specified, @parameter must also be specified.
0
(success) or 1
(failure).
None.
The effect of sp_altermessage
with the WITH_LOG
option is similar to that of the RAISERROR WITH LOG
parameter, except that sp_altermessage
changes the logging behavior of an existing message. If a message is altered to be WITH_LOG
, it is always written to the Windows application log, regardless of how a user invokes the error. Even if RAISERROR
is executed without the WITH_LOG
option, the error is written to the Windows application log.
System messages can be modified by using sp_altermessage
.
Requires membership in the serveradmin fixed server role.
The following example writes the existing message 55001
to the Windows application log.
EXEC sp_altermessage 55001, 'WITH_LOG', 'true';
GO
Peristiwa
31 Mac, 11 PTG - 2 Apr, 11 PTG
Acara pembelajaran SQL, Fabric dan Power BI terbesar. 31 Mac - 2 April. Gunakan kod FABINSIDER untuk menjimatkan $400.
Daftar hari ini