How would I return multiple values (say, a number and a string) from a user-defined function in SQL Server inside a query?
e.g select col1, dbo.function1(col2) from table
and the result to be
Col1 | Col2 | Col3
-----+-------------------+---------------------
x | Num from function | String from function
I don’t want to call the function 2 times because i use some complex code and i don’t want to execute it twice. Just to take the final 2 results in the Return
Extract from – http://www.sqlteam.com/article/returning-complex-data-from-user-defined-functions-with-cross-apply