TryCatch


Snippet Details

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

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