views:

31

answers:

0

Hey all,

I have defined a scalar UDF in SQL Server 2005, which does some calculations on the input variables and returns a float as a result.

This UDF needs to be called from within a select statement to have that calculation result in the query output for each record.

Now, due to the nature of the calculation, an arithmetic overflow can occur regularly in that UDF. In this case, I just want to return NULL, or -1, as a result.

I found out about the limitation in SQL 2005 that you cannot use try catch blocks in UDF's, nor use the raiseerror syntax... so any suggestion on how I might achieve this ?

Thanks