TryCatch


Snippet Details

Shortcut
Description
Adds a Try/Catch including a transaction
Language
SQL
Types
Expansion, SurroundsWith
Author
Fons Sonnemans
Upload on
3/1/2016 7:18:01 PM
Downloads
833

Code Output

        BEGIN TRY
   BEGIN TRAN;
   
  $selected$ $end$
   
   COMMIT;
END TRY
BEGIN CATCH
   IF XACT_STATE() <> 0 ROLLBACK TRANSACTION;
   THROW; -- Rethrow !
END CATCH

    

Download Add to .VSIX Package


comments powered by Disqus

Extension Package

No snippets are added


Languages