How do you assign the result of an exec call to a variable in SQL? I have a stored proc called up_GetBusinessDay, which returns a single date.
Can you do something like this:
exec @PreviousBusinessDay = dbo.up_GetBusinessDay @Date, -1
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
I always use the return value to pass back error status. If you need to pass back one value I’d use an output parameter.
Here’s a sample stored procedure, with an
OUTPUTparameter:Here’s an example of calling the stored procedure, with an
OUTPUTparameter:Output: