SQL Server: Do I have to create a transaction?

1143015 pts.
Tags:
SQL Server
In SQL Server, I'm wondering if it's not right to always create a transaction. Is it really necessary? This is mainly for when I'm doing an update too. Thank you. I apologize for the short question. Thank you.
1

Answer Wiki

Thanks. We'll let you know when a new response is added.

Take a look at following discussion thread. It may help shed some light on your query.
http://dba.stackexchange.com/questions/43254/is-it-a-bad-practice-to-always-create-a-transaction

Discuss This Question: 2  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.
  • danieljones
    Transaction is a single unit of work, with an update context you can use transactions and with select context there is no need to create a transaction.  
    2,840 pointsBadges:
    report
  • BOUZAHME
    Hi ITKE,
    First there are 2 type of transactions: Implicit and explicit one.

    Implicit Transaction
        When a connection is operating in implicit transaction mode, the instance of the SQL Server Database Engine
        automatically starts a new transaction after the current transaction is committed or rolled back.
        You do nothing to delineate the start of a transaction; you only commit or roll back each transaction.
        Implicit transaction mode generates a continuous chain of transactions. (From BOL).
        it concerns DDL (CREATE, ALTER, DROP, TRUNCATE, GRANT, OPEN, REVOKE, FETCH) and DML (INSERT, UPDATE, DELETE) statements.
       
    Explicit transactions
       
        Explicit transactions are defined and maintained by developpers. They concern DML statements.
    100 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

Thanks! We'll email you when relevant content is added and updated.

Following

Share this item with your network: