gpt4 book ai didi

sql-server - 错误: There are uncommitted transactions

转载 作者:行者123 更新时间:2023-12-02 23:08:41 26 4
gpt4 key购买 nike

我在 SSMS 中打开一个新窗口并运行以下命令:

SET ANSI_DEFAULTS ON 
GO

CREATE PROCEDURE [dbo].[zzz_test2]
(
@a int
)
AS
SET NOCOUNT ON
SET @a=1
RETURN 0
GO

然后关闭窗口,这会导致此警告:

存在未提交的事务。您希望在关闭窗口之前提交这些内容吗?

这是怎么回事?

当我打开一个新的 SSMS 窗口并运行此命令时:

SET ANSI_NULLS  ON  
GO

CREATE PROCEDURE [dbo].[zzz_test2]
(
@a int
)
AS
SET NOCOUNT ON
SET @a=1
RETURN 0
GO

然后关闭窗口,我没有收到任何警告。

最佳答案

described in the documentation对于 ANSI_DEFAULTS

When enabled (ON), this option enables the following ISO settings:

SET ANSI_NULLS
SET CURSOR_CLOSE_ON_COMMIT
SET ANSI_NULL_DFLT_ON
SET IMPLICIT_TRANSACTIONS
SET ANSI_PADDING
SET QUOTED_IDENTIFIER
SET ANSI_WARNINGS

据记录hereIMPLICIT_TRANSACTIONS 开启时。

Transactions that are automatically opened as the result of this setting being ON must be explicitly committed or rolled back by the user at the end of the transaction

关于sql-server - 错误: There are uncommitted transactions,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5378357/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com