COMMIT Statement

Makes changes to the database permanent, or terminates a user-defined transaction.

Quick Links:

Go to Examples

Go to Usage

Go to Standards

Go to Permissions

Syntax

Syntax 1 – To end a transaction and makes all changes permanent

COMMIT [ WORK ]

Syntax 2 – To construct nested transactions

COMMIT TRAN[SACTION ] [ transaction-name ]

Examples

(back to top)

Usage

(back to top)

Side effects:
  • Closes all cursors except those opened WITH HOLD.
  • Deletes all rows of declared temporary tables on this connection, unless they were declared using ON COMMIT PRESERVE ROWS.

Standards

(back to top)

  • SQL—ISO/ANSI SQL compliant.
  • SAP Sybase Database product—Supported by Adaptive Server. Syntax 2 is a Transact-SQL extension to ISO/ANSI SQL grammar.

Permissions

(back to top)

Must be connected to the database.

Related reference
BEGIN TRANSACTION Statement [T-SQL]
CONNECT Statement [ESQL] [Interactive SQL]
DISCONNECT Statement [Interactive SQL]
ROLLBACK Statement
SAVEPOINT Statement
SET CONNECTION Statement [ESQL] [Interactive SQL]
COOPERATIVE_COMMIT_TIMEOUT Option
COOPERATIVE_COMMITS Option
DELAYED_COMMITS Option
DELAYED_COMMIT_TIMEOUT Option