esquare
esquare

Reputation: 4275

What is SQL Server implict transaction exactly?

What is Implict Transaction. What is scope? Which command included this transaction group?

Upvotes: 1

Views: 123

Answers (3)

Lasse V. Karlsen
Lasse V. Karlsen

Reputation: 391496

According to the documentation for Implicit Transactions:

  • You have to specifically enable it for a connection
  • When enabled, every time you COMMIT or ROLLBACK a transaction, a new one is started upon the next command that needs it (there is a list in the documentation)

This means that:

  • When enabled, you always have to COMMIT or ROLLBACK

Your question could also be asking about the difference between implicit and explicit transactions.

Microsoft SQL Server always runs modifications (simplified, there are some things that runs without, like bulk insert) in a transaction. In other words, if you haven't specifically opened a transaction, the following is how every modification is run:

try
    ... modification here (update, insert, delete...)
on exception
    rollback
on success
    commit

Upvotes: 1

SQLMenace
SQLMenace

Reputation: 135111

any command that you run is part of an implicit transaction , sql server starts an implicit transaction to have the DB in an ACID state, this way it can rollback if there is an error

an Explicit transation is one that start with BEGIN TRANSACTION

Upvotes: 1

Related Questions