Do we need to execute Commit statement after Update in SQL Server

后端 未结 2 915
执笔经年
执笔经年 2021-02-02 10:54

I have done some update to my record through SQL Server Manager.

As Update statement is not having explicit commit, I am trying to write it manually.

Upd         


        
2条回答
  •  囚心锁ツ
    2021-02-02 11:18

    The SQL Server Management Studio has implicit commit turned on, so all statements that are executed are implicitly commited.

    This might be a scary thing if you come from an Oracle background where the default is to not have commands commited automatically, but it's not that much of a problem.

    If you still want to use ad-hoc transactions, you can always execute

    BEGIN TRANSACTION
    

    within SSMS, and than the system waits for you to commit the data.

    If you want to replicate the Oracle behaviour, and start an implicit transaction, whenever some DML/DDL is issued, you can set the SET IMPLICIT_TRANSACTIONS checkbox in

    Tools -> Options -> Query Execution -> SQL Server -> ANSI
    

提交回复
热议问题