Link to home
Create AccountLog in
Avatar of Robert Cannistraci
Robert Cannistraci

asked on

Function is Correct, but Returns Incorrect Value when Called by SP

A function returning a string does so correctly when calling it as stand-alone correctly returns:

EXEC EmployeeDietaryRestriction_SELECT_DietPerEmpID 184

Returns: 'Gluten-Free,Vegetrian,Vegan,' < correct

However, when called in an SP it returns a incorrect value:

EXEC @DietaryRestriction = EmployeeDietaryRestriction_SELECT_DietPerEmpID @EmployeeID --184

It Returns: '0' which is incorrect. It looks like a result code.

Why doesn't it work called from an SP? What am I missing here? Thank you for any help.
ASKER CERTIFIED SOLUTION
Avatar of Scott Pletcher
Scott Pletcher
Flag of United States of America image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
Avatar of Robert Cannistraci
Robert Cannistraci

ASKER

My bad. It was a proc. I changed it to a function and all is well. Thanks for the help