Committing Work in a SQL Script
Go Up to Using SQL Scripts
Changes to the database from data definition (DDL) statements—for example, CREATE
and ALTER
statements—are automatically committed by default. This means that other users of the database see changes as soon as each DDL statement is executed. To turn off automatic commit of DDL in a script, use SET AUTODDL OFF
, or set it in the Query Options dialog. See Using InterBase Manager to Start and Stop InterBase for more information.
When creating tables and other database objects with
AUTODDL OFF
, it is good practice to put a COMMIT
statement in the SQL script after each CREATE
statement or group of related statements. This ensures that other users of the database see the objects immediately.Changes made to the database by data manipulation (DML) statements—for example INSERT
and UPDATE
—are not permanent until they are committed. Commit changes in a script with COMMIT
. To undo all database changes since the last COMMIT
, use ROLLBACK
. For the full syntax of COMMIT
and ROLLBACK
, see the Language Reference book.