Error handling in UDF - I

Tuesday, 2 June 2009

                                                 There's no straight forward way for exception handling in a UDFand programmers often let the caller code to handle the error in such cases.You can still write exception handling blocks in the CLR(The common language runtime) UDFs in SQL server 2005/later.Apart from the giving better performance than T-SQL ,the CLR,allows the programmer to perform funtionality which are not available in T-SQL.Will see how to implement this in the upcoming posts!

1 comments:

CLR programming in T-SQL is a great advantage to developers who are from .Net Background. (C#, Vb.net etc). You can write very complex logic in C#/Vb.net and call it in SQL Server.

I found it CLR programming very useful because it's almost impossible to handle exception in UDF and CLR programming is best solution for it.

I also believe that instead of using cursors in SQL Server developers should go for CLR programs as it takes less execution time comparatively and easy to write and debug as it could be done Visual Studio.