(错误)消息目录视图 - sys.messagesMessages (for errors) Catalog Views - sys.messages

适用于:Applies to: 是SQL ServerSQL Server(所有支持的版本)yesSQL ServerSQL Server (all supported versions) 适用于:Applies to: 是SQL ServerSQL Server(所有支持的版本)yesSQL ServerSQL Server (all supported versions)

系统中的错误消息的每个 message_idlanguage_id 都包含一行,适用于系统定义消息和用户定义的消息。Contains a row for each message_id or language_id of the error messages in the system, for both system-defined and user-defined messages. 有关详细信息,请参阅 sp_addmessage (Transact-SQL)For more information, see sp_addmessage (Transact-SQL).

列名称Column name 数据类型Data type 说明Description
message_idmessage_id intint 消息的 ID。ID of the message. 此 ID 在服务器中是唯一的。Is unique across server. 编号在 50000 以下的消息 ID 是系统消息。Message IDs less than 50000 are system messages.
language_idlanguage_id smallintsmallint 用于 文本 的语言 ID,如 sys.syslanguages 中所定义。Language ID for which the text in text is used, as defined in syslanguages. 这对于指定 message_id 是唯一的。This is unique for a specified message_id.
severity severity tinyinttinyint 消息的严重级别,在 1 到 25 之间。Severity level of the message, between 1 and 25. 这对于 message_id 中的所有消息语言都是相同的。This is the same for all message languages within a message_id.
is_event_loggedis_event_logged bitbit 1 = 出现错误时将消息记入事件日志。1 = Message is event-logged when an error is raised. 这对于 message_id 中的所有消息语言都是相同的。This is the same for all message languages within a message_id.
texttext nvarchar(2048)nvarchar(2048) 对应的 language_id 处于活动状态时使用的消息文本。Text of the message used when the corresponding language_id is active.

权限Permissions

要求 公共 角色具有成员身份。Requires membership in the public role. 有关详细信息,请参阅 Metadata Visibility ConfigurationFor more information, see Metadata Visibility Configuration.

另请参阅See Also

THROW (Transact-SQL) THROW (Transact-SQL)
目录视图 (Transact-SQL) Catalog Views (Transact-SQL)
消息 () 目录视图的错误 (Transact-sql) Messages (for Errors) Catalog Views (Transact-SQL)
异常消息框编程 Exception Message Box Programming
错误消息 Error Messages
数据库引擎错事件和错误Database Engine Events and Errors