June 2, 2014 at 12:28 pm
Hi,
I have a procedure (a) where i call another procedure (b) passing @message as a parameter to procedure B.
Ex:
Create procedure a
as
Begin
declare @prevyear
exec b @message = 'avvasdva' + cast(@prevyear as varchar)
End
When i execute above procedure, i get error at + sign i.e. @message parameter. how can i concatenate string with another parameter when passing parameters
June 2, 2014 at 1:05 pm
vasuarjula (6/2/2014)
Hi,I have a procedure (a) where i call another procedure (b) passing @message as a parameter to procedure B.
Ex:
Create procedure a
as
Begin
declare @prevyear
exec b @message = 'avvasdva' + cast(@prevyear as varchar)
End
When i execute above procedure, i get error at + sign i.e. @message parameter. how can i concatenate string with another parameter when passing parameters
Check out this page and if you have any further questions, feel free!
😎
June 2, 2014 at 1:57 pm
Parameters cannot be expressions.
Need an answer? No, you need a question
My blog at https://sqlkover.com.
MCSE Business Intelligence - Microsoft Data Platform MVP
June 2, 2014 at 3:44 pm
Koen Verbeeck (6/2/2014)
Parameters cannot be expressions.
That's step one, for sure. Step 2 is that the variable is assigned no value and will always return a NULL for the result of the concatentation. Step 3 is that the variable if the variable is provided from sources external to the proc, a check needs to be done for SQL Injection.
--Jeff Moden
Change is inevitable... Change for the better is not.
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply