Reputation: 573
All language like C#,VB.NET all have try catch finally block but SQL server only have try and catch only why not finally block is given is there any specific reason for that?
Upvotes: 6
Views: 5012
Reputation: 17090
There are many other problems with TRY...CATCH block, such as you cannot rethrow an error exactly as you caught it, so I would use C# error handling for anything complex. I have wrote a whole book chapter on it, you can download a free pdf here
Upvotes: 7
Reputation: 41849
In my opinion TRY/CATCH/FINALLY is very much a procedural programming method and therefore does not really have a place or need to be included within T-SQL, what is considered to be very much a SET based programming language.
As wallyk states and I agree, the existing TRY/CATCH Block in T-SQL caters for the vast majority of requirements.
I wonder if perhaps you are trying to implement complex process logic that would be better housed/managed in the application tier.
Upvotes: 0
Reputation: 57784
It's because the default error handling is often good enough. It used to be hard to write code which could compile but cause some bad fault.
Upvotes: 0