自动提交事务 自动提交模式是 Microsoft® SQL Server™ 的默认事务管理模式。每个 Transact-SQL 语句在完成时,都被提交或回滚。如果一个语句成功地完成,则提交该语句;如果遇到错误,则回滚该语句。只要自动提交模式没有被显式或隐性事务替代,SQL Server 连接就以该默认模式进行操作。自动提交模式也是 ADO、OLE DB、ODBC 和 DB-Library 的默认模式。SQL Server 连接在 BEGIN TRANSACTION 语句启动显式事务,或隐性事务模式设置为打开之前,将以自动提交模式进行操作。当提交或回滚显式事务,或者关闭隐性事务模式时,SQL Server 将返回到自动提交模式。编译和运行时错误
An application calls SQLSetConnectAttr to switch between the two ODBC modes of managing transactions: Autocommit mode Each individual statement is automatically committed when it completes successfully. When running in autocommit mode no other transaction management functions are needed.Manual-commit mode All executed statements are included in the same transaction until it is specifically terminated by calling SQLEndTran.Autocommit mode is the default transaction mode for ODBC. When a connection is made, it is in autocommit mode until SQLSetConnectAttr is called to switch to manual-commit mode by setting autocommit mode off. When an application turns autocommit off, the next statement sent to the database starts a transaction. The transaction then remains in effect until the application calls SQLEndTran with either the SQL_COMMIT or SQL_ROLLBACK options. The command sent to the database after SQLEndTran starts the next transaction.
自动提交模式是 Microsoft® SQL Server™ 的默认事务管理模式。每个 Transact-SQL 语句在完成时,都被提交或回滚。如果一个语句成功地完成,则提交该语句;如果遇到错误,则回滚该语句。只要自动提交模式没有被显式或隐性事务替代,SQL Server 连接就以该默认模式进行操作。自动提交模式也是 ADO、OLE DB、ODBC 和 DB-Library 的默认模式。SQL Server 连接在 BEGIN TRANSACTION 语句启动显式事务,或隐性事务模式设置为打开之前,将以自动提交模式进行操作。当提交或回滚显式事务,或者关闭隐性事务模式时,SQL Server 将返回到自动提交模式。编译和运行时错误
Each individual statement is automatically committed when it completes successfully. When running in autocommit mode no other transaction management functions are needed.Manual-commit mode
All executed statements are included in the same transaction until it is specifically terminated by calling SQLEndTran.Autocommit mode is the default transaction mode for ODBC. When a connection is made, it is in autocommit mode until SQLSetConnectAttr is called to switch to manual-commit mode by setting autocommit mode off. When an application turns autocommit off, the next statement sent to the database starts a transaction. The transaction then remains in effect until the application calls SQLEndTran with either the SQL_COMMIT or SQL_ROLLBACK options. The command sent to the database after SQLEndTran starts the next transaction.