Skip to content

Instantly share code, notes, and snippets.

@jeffsaracco
Created October 27, 2011 13:56
Show Gist options
  • Save jeffsaracco/1319605 to your computer and use it in GitHub Desktop.
Save jeffsaracco/1319605 to your computer and use it in GitHub Desktop.
SQL Transaction w/rollback
BEGIN TRANSACTION
--SQL CODE HERE
if @@ERROR <> 0
BEGIN
ROLLBACK TRANSACTION
END
ELSE
BEGIN
COMMIT TRANSACTION
END
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment