[英]How to set BEGIN_TRANSACTION automatically in SSMS (SQL Server Management Studio)?
With Options > Query Execution > ANSI > SET IMPLICIT_TRANSACTIONS
, each batch is not committed automatically. 使用
Options > Query Execution > ANSI > SET IMPLICIT_TRANSACTIONS
,不会自动提交每个批次。
Even so, I have to run begin transaction
in batch explicitly, ie if I just run update table_name set col_name = 'something'
without the begin trans
, the update is automatically committed, can I actually ask set up SSMS such that it will automatically create a transaction when I execute a update\\insert\\delete
batch? 即使这样,我也必须显式地批量运行
begin transaction
,即如果我只运行update table_name set col_name = 'something'
而没有begin trans
,则更新将自动提交,我是否可以要求设置SSMS使其自动创建执行update\\insert\\delete
批处理时进行交易?
I think the IMPLICIT_TRANSACTIONS setting works the way that you are hoping it does. 我认为IMPLICIT_TRANSACTIONS设置的工作方式与您希望的一样。 Unless i'm understanding your question incorrectly.
除非我不正确地理解您的问题。
Have you looked at the MSDN ? 您是否看过MSDN ?
SET IMPLICIT_TRANSACTIONS to Checked in SSMS 将SET IMPLICIT_TRANSACTIONS设置为已在SSMS中检查
Then open a new query window 然后打开一个新的查询窗口
USE TempDb
CREATE TABLE tmp (f INT)
INSERT tmp VALUES (1)
print @@trancount
is 1. Isn't that what you're looking for? 是1.不是您要的内容吗? And if you try and close the window, you will be prompted that there are uncommitted transactions.
并且,如果尝试关闭窗口,系统将提示您有未提交的事务。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.