Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

RAISERROR raises substitution parameter error

following T-Sql code:

DECLARE @usu VARCHAR(10);
SET @usu = 'TOM';
PRINT @usu;
RAISERROR ('Name of USU is %i ',14,2,@usu);

returns following error:

Msg 2786, Level 16, State 1, Line 4
The data type of substitution parameter 1 does not match the expected type of the format specification.

Does anyone know how I can get rid of this error?

like image 875
Tom Stevens Avatar asked Sep 16 '25 19:09

Tom Stevens


1 Answers

Yeah, change your format to Name of USU is %s, the %i means the value of @usu is a signed integer. All of the format types are clearly documented on MSDN.

like image 165
Mike Perrenoud Avatar answered Sep 19 '25 08:09

Mike Perrenoud