Is this an error in SQL Server's documentation for ROLLBACK?

All we need is an easy explanation of the problem, so here it is.

This is the SQL Server’s document talking about the ROLLBACK statement. On that page it states that the syntax of it is as follows:

     [ transaction_name | @tran_name_variable  
     | savepoint_name | @savepoint_variable ]   
[ ; ]  

Apparently the stuff inside square brackets are optional and it seems you should choose one from TRAN or TRASACTION. But in fact you can completely omit both and ROLLBACK is a perfectly valid statement. Is this an error or intentionally?

How to solve :

I know you bored from this bug, So we are here to help you! Take a deep breath and look at the explanation of your problem. We have many solutions to this problem, But we recommend you to use the first method because it is tested & true method that will 100% work for you.

Method 1

The ROLLBACK TRANSACTION documentation is correct, albeit not clear without additional context.

ROLLBACK is shorthand for the similar ROLLBACK WORK statement rather than ROLLBACK TRANSACTION. Below is an excerpt from the ROLLBACK WORK doc page:


This statement functions identically to ROLLBACK TRANSACTION except
that ROLLBACK TRANSACTION accepts a user-defined transaction name.
With or without specifying the optional WORK keyword, this ROLLBACK
syntax is ISO-compatible.

When nesting transactions, ROLLBACK WORK always rolls back to the
outermost BEGIN TRANSACTION statement and decrements the @@TRANCOUNT
system function to 0.

Note the same applies to the similar COMMIT TRANSACTION and COMMIT WORK statements.

Note: Use and implement method 1 because this method fully tested our system.
Thank you 🙂

All methods was sourced from or, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply