If your function returns a string, you can always insert a return, for example.
ALTER FUNCTION dbo.whatever() RETURNS NVARCHAR(128) AS BEGIN DECLARE @foo VARCHAR(128); SELECT TOP (1) @foo = name FROM sys.objects ORDER BY NEWID();
If the variable is numeric or date, you can use RTRIM () or CONVERT () to safely convert it to a string first.
You can do something similar with a table function, just add a column in which you can place any debug message or variable that you want to output.
Aaron Bertrand May 23 '12 at 14:20 2012-05-23 14:20
source share