sqltransactionsrollback

Transaction Processing: When does a rollback occur?


Recently this question was posted about the definition of what a transaction is in a general context. A common answer to this question was that a transaction should be an atomic unit of work

My question relates to this atomicity (i think) I often see explicit calls to ROLLBACK in SQL stored procedures.

Is it generally a common requirement of transaction processing systems that rollbacks be explicitly called for?

Does a rollback occur automatically if some error occurs when committing?


Solution

  • In TP systems, rollback can occur based on:

    A rollback need not occur as you say "when committing", by which I guess you mean "when attempting to commit." A transaction can rollback at any time after inception.