Sunday, October 20, 2019

Concatenate Message In RAISERROR

DECLARE @temp varchar(50)
DECLARE @ID int=1234

SELECT @temp= CAST(@ID AS VARCHAR(50))

RAISERROR(N'This is how you concat with Raise Error %s',1,1 ,@temp);


output is


/*------------------------
DECLARE @temp varchar(50)
DECLARE @ID int=1234

SELECT @temp= CAST(@ID AS VARCHAR(50))

RAISERROR(N'This is how you concat with Raise Error %s',1,1 ,@temp);
------------------------*/
This is how you concat with Raise Error 1234
Msg 50000, Level 1, State 1

No comments:

Post a Comment

Recently Executed queries

 SELECT     txt.TEXT AS [SQL Statement],     qs.EXECUTION_COUNT [No. Times Executed],     qs.LAST_EXECUTION_TIME AS [Last Time Executed],   ...