Skip to content
Advertisement

Error – Select statements included within a function cannot return data to a client

I am trying to create a function that will query times in a table and then return the correct time based on the site.

The times in the table being queried have the opening and closing times of the branch. I am not sure if I should be using CASE or IF.

When I use CASE, I get this error:

Msg 444, Level 16, State 2, Procedure WorkTime, Line 33
Select statements included within a function cannot return data to a client.

When I print to screen it works fine.

/added this for the site times open and close/

Advertisement

Answer

First of all I think you didn’t specify all requirements. I expect that you pass the location code to the function.

your function could have a look like

User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement