If debugging outside the database is not sufficient, you can use trace tables to get trace diagnostic output. Debugging UDFs using trace tables is similar to debugging external stored procedures using trace tables. For details, see Debugging Using Trace Tables.