Error handling in SQL SERVER 2008

  • In SQL SERVER 2000, after running each SQL Statment ,I was checking @@Error variable, tomake sure that there was not any error.In SQL SERVER 2008,there is Try/Catch block,which is much easier.Is there any performance consideration in using Try/Catch blocks?

    Or there is nothing special thing on that.

  • Aspet Golestanian Namagerdi (3/22/2010)


    In SQL SERVER 2000, after running each SQL Statment ,I was checking @@Error variable, tomake sure that there was not any error.In SQL SERVER 2008,there is Try/Catch block,which is much easier.Is there any performance consideration in using Try/Catch blocks?

    Or there is nothing special thing on that.

    There is a small overhead, but nothing like as significant as try...catch...finally in .NET languages, for example.

    Remember that T-SQL is an interpreted language, not compiled, so there are plenty of other overheads that outweigh this consideration. Use TRY...CATCH in SQL Server to maximize your chances of catching an error condition.

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply