We are using SQL 2005 and the try-catch functionality to handle all of our error handling within the DB. We are currently working on deploying a .NET CLR function to make some WCF calls in the DB. This WCF procedure is written in the CLR and then deployed to SQL. If I put a try-catch block in the CLR code, it catches the error fine. However, I can't seem to throw the error up to the try-catch block in SQL. SQL seems to ignore what I throw it and catches the error it finds. Is there no relation between the two (i.e. I can't throw from one to another?)
If I can throw from within the CLR to the calling procedure in SQL, is any special formatting needed? I tried a specific case of catching the error that was thrown, and then throwing a different error, but SQL ignored my thrown error and caught the original error, as if it ignored the thrown error.