SQL Server/T-SQL Tutorial/String Functions/FORMATMESSAGE
FORMATMESSAGE function
4>
5>
6> DECLARE @parm1 varchar(30), @parm2 int, @message varchar(100)
7> SELECT @parm1=USER_NAME(), @parm2=@@spid
8> SELECT @message = FORMATMESSAGE(50001, @parm1, @parm2)
9> PRINT "The message is: " + @message
10> GO
The message is: The specified value for dbo was invalid.
1>
2>