I am trying to use a function to pass a parameter to a stored-procedure.
But this:
exec stpMySTP dbo.fn_MyFunction(123)
generates an error:
Incorrect syntax near '.'.
Is it not possible to use a function when passing parameters to a procedure?
You cant pass it directly to stored procedure. Declare first variable, set it to your function and then pass it to the procedure.
DECLARE @pom [return type of function];
SET @pom = dbo.fn_MyFunction(123);
EXEC stpMySTP @pom
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With