SQL Server Interview Question #143

What is COMMIT?

Transactions, Locking, Blocking & Deadlocks Senior Advanced

Detailed Explanation

COMMIT makes the changes performed by the current transaction permanent and ends that transaction.

Applications should commit only after all required operations have completed successfully. Once committed, the transaction cannot simply be undone with ROLLBACK; reversing it requires another compensating data operation or recovery process.

Code Example

BEGIN TRANSACTION;

UPDATE dbo.Products
SET Price = Price * 1.05
WHERE CategoryId = 10;

COMMIT TRANSACTION;