FORMATMESSAGE

Description

Constructs a message from an existing message in sys.messages or from a provided string. (FORMATMESSAGE in Transact-SQL).

Sample Source Pattern

Since Snowflake does not support FORMATMESSAGE function, the FORMATMESSAGE_UDF is added to simulate its behavior.

Syntax

FORMATMESSAGE ( { msg_number  | ' msg_string ' | @msg_variable} , [ param_value [ ,...n ] ] )  

Examples

Code:

IN -> SqlServer_01.sql
SELECT FORMATMESSAGE('This is the %s and this is the %s.', 'first variable', 'second variable') AS RESULT;

Result:

                                                     RESULT|
-----------------------------------------------------------+
This is the first variable and this is the second variable.|

Last updated