Home Dashboard Directory Help
Search

Books Online: FORMATMESSAGE Syntax by Scott Duncan


Status: 

Active


1
0
Sign in
to vote
Type: Suggestion
ID: 793926
Opened: 7/14/2013 3:47:12 PM
Access Restriction: Public
0
Workaround(s)
view

Description


It appears the SQL Server 2012 version of FORMATMESSAGE supports using a message string instead of just a message number for the first parameter. This is not reflected in Books Online (I found this through reading the training kit for exam 70-461). Using the example from the book (page 437):

DECLARE @message AS NVARCHAR(1000) = 'Error in %s stored procedure';
SELECT @message = FORMATMESSAGE (@message, N'usp_InsertCategories');
RAISERROR (@message, 16, 0);
Details
Sign in to post a comment.
Posted by Microsoft on 7/15/2013 at 8:09 AM
I can see that this works, but I'm not sure that is intended. It could just be an artifact of sharing a code path with RAISERROR. But this usage seems not to be in support of the goal of FORMATMESSAGE. So it is likely not a supported and guaranteed result.
Posted by Microsoft on 7/15/2013 at 7:56 AM
Thank you for submitting this. I'll take a look.
Sign in to post a workaround.