COMMIT Statement

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

Syntax

Syntax 1

COMMIT [ WORK ]

Syntax 2

COMMIT TRAN[SACTION ] [ transaction-name ]

Examples

Usage

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

  • SQL—ISO/ANSI SQL compliant.

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

Permissions

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