Skip to content

Instantly share code, notes, and snippets.

@YurePereira
Last active July 5, 2016 00:34
Show Gist options
  • Select an option

  • Save YurePereira/638543c8aefbdb2fe4ecdd2640f522e7 to your computer and use it in GitHub Desktop.

Select an option

Save YurePereira/638543c8aefbdb2fe4ecdd2640f522e7 to your computer and use it in GitHub Desktop.
-- Template to use transaction in SQL Server
GO
USE your_database_name;
GO
BEGIN TRANSACTION tran_your_transaction_name;
GO
--
-- SQL Commands here.
--
GO
IF @@ERRROR <> 0
ROLLBACK TRANSACTION tran_your_transaction_name;
ELSE
COMMIT TRANSACTION tran_your_transaction_name;
GO
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment