What is the new error handling technique in SQL Server 2005?Previously, error handling was done using @@ERROR or check @@ROWCOUNT, which didn’t turn out to be a very feasible option for fatal errors. New error handling technique in SQL Server 2005 provides a TRY and CATCH block mechanism. When an error occurs the processing in the TRY block stops and processing is then picked up in the CATCH block. TRY CATCH constructs traps errors that have a severity of 11 through 19 as well.What is the new error handling technique in SQL Server 2005?SQL Server 2005 introduces a new exception handling paradigm using TRY / CATCH blocks in T-SQL. The errors are well trapped in the try block and the execution is transferred to the catch block. The circumstances like using cursors… the cursor is allocated for opening in the TRY block at the time of occurring an error is thrown to CATCH block to determine whether it is open. If it is open, it should be close and deallocate.
SQL Server 2005 still supports the @@ERROR function, but TRY / CATCH is a much better option.
|