SAVEPOINT
SAVEPOINT is a SQL statement in the Transactions category. Sets a named point within a transaction that you can ROLLBACK to without affecting previous work. The syntax is SAVEPOINT savepoint_name;. It returns savepoint created. A typical example: START TRANSACTION; INSERT INTO log VALUES ('step 1'); SAVEPOINT sp1; INSERT INTO log VALUES ('step 2'); ROLLBACK TO SAVEPOINT sp1; -- Undoes step 2, keeps step 1 COMMIT; -- Step 1 is committed A close relative is BEGIN / START TRANSACTION, which begins a new transaction. Changes made within are invisible to others until COMMIT. A close relative is COMMIT, which saves all changes made in the current transaction permanently. A close relative is ROLLBACK, which undoes all changes made in the current transaction (or to a savepoint). More about this category: Transaction control — BEGIN, COMMIT, ROLLBACK, SAVEPOINT, ACID properties. Related Transactions entries: BEGIN / START TRANSACTION, COMMIT, ROLLBACK, SET TRANSACTION / ISOLATION LEVEL, AUTOCOMMIT, DEADLOCK, XACT_ABORT, READ ONLY / READ WRITE.