Wednesday , November 30 2022

SQL Server Sys Messages

In today’s article we will talk about SQL Server Sys Messages error.

The SQL Server sys.messages table or catalog table has error messages displayed by SQL Server when an error occurs. The error message is in the catalog views sys.sysmessages and sys.messages and there are values in the master.sys.sysusermsgs table.

The severity level tells us the type of problem. To help us understand what each of the severity level means

Visit the address.

A user can add custom error messages with severity 1-25 using the sp_addmessage stored procedure. The following query adds a custom message to the sys.messages catalog view. Transact-SQL

1234    USE master;GOEXEC sp_addmessage 51000, 16,   N‘This is a custom error message’

We get the query output as follows.

The procedure adds a custom message “This is a custom error message” with message_id 51000 and severity 16 to the sys.messages view.

The custom message is added to the sys.messages table as shown in the snapshot above.


About Çağlar Özenç

Leave a Reply

Your email address will not be published. Required fields are marked *