Skip to Main Content
SQL in a Nutshell
book

SQL in a Nutshell

by Kevin Kline
December 2000
Intermediate to advanced content levelIntermediate to advanced
224 pages
9h 52m
English
O'Reilly Media, Inc.
Content preview from SQL in a Nutshell

Name

START TRANSACTION

Synopsis

New in SQL99, the START TRANSACTION statement allows all the functions of SET TRANSACTION to be performed and allows a new transaction to be initiated.

Vendor

Command

SQL Server

Not supported; see BEGIN TRAN later

MySQL

Not supported

Oracle

Not supported

PostgreSQL

Not supported; see BEGIN TRAN later

SQL99 Syntax and Description

START TRANSACTION { {READ ONLY | READ WRITE}[,...]
| ISOLATION LEVEL 
  {READ COMMITTED 
  | READ UNCOMMITTED 
  | REPEATABLE READ
  | SERIALIZABLE}[,...]
| DIAGNOSTIC SIZE INT};

The only difference between SET and START is that SET is considered outside of the current transaction, while START is considered the marking of a new transaction.

BEGIN TRANSACTION

The command BEGIN TRANSACTION provides similar functionality to START TRANSACTION. Both Microsoft SQL Server and PostgreSQL support BEGIN TRANSACTION, though they have slight variations in their syntax. Oracle supports implicit, but not explicit, transactions. MySQL doesn’t support atomic transactions at all. BEGIN TRANSACTION declares an explicit transaction, but it does not set isolation levels.

The Microsoft SQL Server syntax is:

BEGIN TRAN[SACTION] [transaction_name | @transaction_variable
[WITH MARK [ 'log_description' ] ] ]

Microsoft SQL Server allows a name to be assigned to a transaction or to reference transactions using a variable. It does not affect or add to functionality. When nesting transactions, only the outermost BEGIN . . . COMMIT or BEGIN . . . ROLLBACK ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

SQL in a Nutshell, 3rd Edition

SQL in a Nutshell, 3rd Edition

Kevin Kline

Publisher Resources

ISBN: 1565927443