March 25, 2008 at 1:52 pm
I didn't think this is allowed but i figured I would ask anyway. I have this:
declare @STR varchar(max)
set @STR = fnGetValue()
exec mySproc @param1 = @STR
I want to do this:
exec mySproc @param1 = fnGetValue()
but this of course will error out with syntax errors....am I correct in assuming I'm stuck with declaring the variable and then passing to the stored procedure or is there syntatically a better way to do this?
March 25, 2008 at 2:17 pm
yeah thats what i'm doing now (meant to write select instead of set). My question was is it possible to use the function directly in the parameter for the stored procedure instead of having to declare a variable, select the value into the variable and then pass that into the procedure parameter....
March 25, 2008 at 2:38 pm
No, you cannot do that.
March 25, 2008 at 6:01 pm
Parameters work better when you use sp_executeSQL instead of just EXEC. I'm thinking you could do that using sp_ExecuteSQL.
----------------------------------------------------------------------------------
Your lack of planning does not constitute an emergency on my part...unless you're my manager...or a director and above...or a really loud-spoken end-user..All right - what was my emergency again?
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply