<?xml version="1.0" encoding="utf-8" ?>
<CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
  <CodeSnippet Format="1.0.0">
    <Header>
      <Title>TryCatch</Title>
      <Shortcut></Shortcut>
      <Description>Adds a Try/Catch including a transaction</Description>
      <Author>Fons Sonnemans</Author>
      <SnippetTypes>
        <SnippetType>Expansion</SnippetType>
        <SnippetType>SurroundsWith</SnippetType>
      </SnippetTypes>
    </Header>
    <Snippet>
      <Code Language="SQL">
        <![CDATA[BEGIN TRY
   BEGIN TRAN;
   
  $selected$ $end$
   
   COMMIT;
END TRY
BEGIN CATCH
   IF XACT_STATE() <> 0 ROLLBACK TRANSACTION;
   THROW; -- Rethrow !
END CATCH
]]>
      </Code>
    </Snippet>
  </CodeSnippet>
</CodeSnippets>

