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.
Microsoft SQL Server

Avatar of undefined
Last Comment
Robert Cannistraci

8/22/2022 - Mon