訊息 (錯誤) 目錄檢視-sys.messagesMessages (for errors) Catalog Views - sys.messages

適用於: 是SQL Server (從 2008 開始) 否Azure SQL Database 否Azure SQL 資料倉儲 否平行處理資料倉儲 APPLIES TO: yesSQL Server (starting with 2008) noAzure SQL Database noAzure SQL Data Warehouse noParallel Data Warehouse

每個包含一個資料列message_id或是language_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 of the message. 在伺服器中,這是唯一的。Is unique across server. 小於 50000 的訊息識別碼,都是系統訊息。Message IDs less than 50000 are system messages.
language_idlanguage_id smallintsmallint 為其語言識別碼中的文字文字使用,如同syslanguagesLanguage ID for which the text in text is used, as defined in syslanguages. 這是唯一的指定message_idThis is unique for a specified message_id.
severityseverity tinyinttinyint 訊息的嚴重性層級,介於 1 至 25 之間。Severity level of the message, between 1 and 25. 這會是相同的所有訊息內的語言message_idThis 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_idThis 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.

PermissionsPermissions

需要 public 角色的成員資格。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