Back to results for “Transactions & ACID”
SQL Server › Transactions & ACID

What is the difference between an implicit and an explicit transaction in SQL Server?

Intermediate

Answer

An explicit transaction is one you deliberately start with BEGIN TRANSACTION and end with COMMIT or ROLLBACK, giving you full control over exactly what statements are grouped together, while by default SQL Server treats each individual statement as its own implicit transaction, automatically committing it immediately if it succeeds without requiring any explicit transaction control statements.
-- Implicit: each statement is automatically its own transaction
UPDATE Orders SET Status = 'Shipped' WHERE OrderId = 1;

-- Explicit: multiple statements grouped together deliberately
BEGIN TRANSACTION;
UPDATE Orders SET Status = 'Shipped' WHERE OrderId = 1;
UPDATE Shipments SET ShippedDate = GETDATE() WHERE OrderId = 1;
COMMIT TRANSACTION;
Real-world example A developer wraps two related updates that must succeed or fail together inside an explicit transaction, rather than relying on the default implicit behavior that would treat each update as entirely independent of the other.

Common follow-ups: What are the risks of relying only on implicit transactions for a multi step business process?;Does SQL Server support any other transaction modes besides implicit and explicit?