troubleshooting Question

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

Avatar of Robert Cannistraci
Robert Cannistraci asked on
Microsoft SQL Server
2 Comments1 Solution44 ViewsLast Modified:
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
Join our community to see this answer!
Unlock 1 Answer and 2 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 2 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros