Saturday , May 28 2022

Using FormatMessage In SQL Server

In today’s article I will talk about Using Formatmessage in SQL Server.

FormatMessage has been around with SQLServer since version 2008. We use it to create a message from a defined message that exists in the sys.messages table. The FORMATMESSAGE function is the same as the RAISERROR statement.

Syntax:
The maximum length of msg_string is 2047 characters. If the message contains more than 2047 charcaters, then it will only display the first 2044 characters and add three points.

If the message does not find any local version of the user, it will use the US English version if it cannot find a localized version of the message.

An error occurred if the variable you passed is not supported by the placeholder.

FormatMessage is useful for writing your own custom message.

About Çağlar Özenç

Leave a Reply

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