XACT_ABORT
XACT_ABORT is a SQL statement in the Transactions category. SQL Server: automatically rolls back the entire transaction when an error occurs. Prevents partial commits. The syntax is SET XACT_ABORT ON;. It returns transaction behavior set. A typical example: SET XACT_ABORT ON; BEGIN TRANSACTION; INSERT INTO log VALUES ('test'); SELECT 1/0; -- Division by zero error -- XACT_ABORT = ON: entire transaction is rolled back -- XACT_ABORT = OFF: only the SELECT fails, INSERT might remain 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, SAVEPOINT, SET TRANSACTION / ISOLATION LEVEL, AUTOCOMMIT, DEADLOCK, READ ONLY / READ WRITE.