Debugging UDF's

PrOpHeT

Member
Joined
Sep 1, 2004
Messages
18
Is there a way to output debugging information in UDFs so I can see the state of variables in various places?
 
I cant think of any direct way to do it. I know you cant put print statements in there. You also wont see the value of variables when using SQL Profiler.

You could modify the function to write values to a table and look at the results after. You could also cut and past the function into Query Analyzer and look at the values there - not as a function, but executing each line one at a time.

If you have the time, you could investigate setting up SQL Server to allow stepping through code. Ive done it once, a long time ago, to step through a stored proc one line at a time. I dont know if you can step into functions though.

-ner
 
Back
Top