What happens if you don't commit a transaction to a database (say, SQL Server)?

前端 未结 9 2282
礼貌的吻别
礼貌的吻别 2020-11-27 03:08

Suppose I have a query:

begin tran
-- some other sql code

And then I forget to commit or roll back.

If another client tries to exec

9条回答
  •  臣服心动
    2020-11-27 03:12

    Any uncomitted transaction will leave the server locked and other queries won't execute on the server. You either need to rollback the transaction or commit it. Closing out of SSMS will also terminate the transaction which will allow other queries to execute.

提交回复
热议问题