Defining Transactions

You can carry out transaction processing with Microsoft SQL Server in three ways:

AutoCommit—Every T-SQL statement is its own transaction and automatically commits when it finishes. This is the default mode in which SQL Server operates.

Explicit—This approach provides programmatic control of the transaction, using the BEGIN TRAN and COMMIT/ROLLBACK TRAN/WORK commands.

Implicit—In this mode, when you issue certain SQL commands, SQL Server automatically starts a transaction. You must finish the transaction by explicitly issuing the COMMIT/ROLLBACK TRAN/WORK commands.

Each of these methods is discussed in the following sections.

Note

The terms for explicit and implicit transactions can be somewhat confusing. The way ...

Get Microsoft® SQL Server 2008 R2 Unleashed now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.