Skip to content

Instantly share code, notes, and snippets.

@dalibormesaric
Created June 24, 2015 07:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dalibormesaric/3f10b58bc2a0e9a07d6d to your computer and use it in GitHub Desktop.
Save dalibormesaric/3f10b58bc2a0e9a07d6d to your computer and use it in GitHub Desktop.
SQL TRANSACTION
BEGIN TRANSACTION
BEGIN TRY
--
--ROLLBACK
COMMIT
TRANSACTION
END TRY
BEGIN CATCH
SELECT
ERROR_NUMBER() AS ErrorNumber,
ERROR_SEVERITY() AS ErrorSeverity,
ERROR_STATE() AS ErrorState,
ERROR_PROCEDURE() AS ErrorProcedure,
ERROR_LINE() AS ErrorLine,
ERROR_MESSAGE() AS ErrorMessage;
ROLLBACK TRANSACTION
END CATCH
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment