Saturday, February 25, 2012

call a stored procedure

How do you call a stored procedure using the "+" sign in the parameter:
exec test_sproc 'this is a ' + 'test'
Do I have to use a variable, like this?
declare @.string varchar
set @.string = 'this is a ' + 'test'
exec test_sproc @.string> How do you call a stored procedure using the "+" sign in the parameter:
> exec test_sproc 'this is a ' + 'test'
>
> Do I have to use a variable, like this?
Yes.
http://www.aspfaq.com/
(Reverse address to reply.)|||Why not ,
exec test_sproc 'this is a test' instead of
exec test_sproc 'this is a ' + 'test'. I am just curious.
"Aaron [SQL Server MVP]" wrote:

> Yes.
> --
> http://www.aspfaq.com/
> (Reverse address to reply.)
>
>|||> exec test_sproc 'this is a test' instead of
> exec test_sproc 'this is a ' + 'test'. I am just curious.
The OP probably simplified. Much more likely to be something like:
declare @.test varchar(32)
set @.test = 'holdup'
exec test_proc 'this is a '+@.test

No comments:

Post a Comment