<i id='AJ6gq'><tr id='AJ6gq'><dt id='AJ6gq'><q id='AJ6gq'><span id='AJ6gq'><b id='AJ6gq'><form id='AJ6gq'><ins id='AJ6gq'></ins><ul id='AJ6gq'></ul><sub id='AJ6gq'></sub></form><legend id='AJ6gq'></legend><bdo id='AJ6gq'><pre id='AJ6gq'><center id='AJ6gq'></center></pre></bdo></b><th id='AJ6gq'></th></span></q></dt></tr></i><div id='AJ6gq'><tfoot id='AJ6gq'></tfoot><dl id='AJ6gq'><fieldset id='AJ6gq'></fieldset></dl></div>

      <small id='AJ6gq'></small><noframes id='AJ6gq'>

      • <bdo id='AJ6gq'></bdo><ul id='AJ6gq'></ul>

    1. <tfoot id='AJ6gq'></tfoot>
      <legend id='AJ6gq'><style id='AJ6gq'><dir id='AJ6gq'><q id='AJ6gq'></q></dir></style></legend>

      如何在 SQL Server 会话中设置自动提交?

      时间:2023-10-09

      <legend id='m3MWY'><style id='m3MWY'><dir id='m3MWY'><q id='m3MWY'></q></dir></style></legend>
        <bdo id='m3MWY'></bdo><ul id='m3MWY'></ul>

            <i id='m3MWY'><tr id='m3MWY'><dt id='m3MWY'><q id='m3MWY'><span id='m3MWY'><b id='m3MWY'><form id='m3MWY'><ins id='m3MWY'></ins><ul id='m3MWY'></ul><sub id='m3MWY'></sub></form><legend id='m3MWY'></legend><bdo id='m3MWY'><pre id='m3MWY'><center id='m3MWY'></center></pre></bdo></b><th id='m3MWY'></th></span></q></dt></tr></i><div id='m3MWY'><tfoot id='m3MWY'></tfoot><dl id='m3MWY'><fieldset id='m3MWY'></fieldset></dl></div>

              <small id='m3MWY'></small><noframes id='m3MWY'>

                  <tbody id='m3MWY'></tbody>
                <tfoot id='m3MWY'></tfoot>
              1. 本文介绍了如何在 SQL Server 会话中设置自动提交?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                如何在 SQL Server 会话中设置自动提交?

                How do you set autocommit in an SQL Server session?

                推荐答案

                你可以通过设置implicit_transactions OFF来开启自动提交:

                You can turn autocommit ON by setting implicit_transactions OFF:

                SET IMPLICIT_TRANSACTIONS OFF
                

                当设置为 ON 时,它返回到隐式事务模式.在隐式事务模式下,您所做的每一次更改都会启动一个您必须手动提交的事务.

                When the setting is ON, it returns to implicit transaction mode. In implicit transaction mode, every change you make starts a transactions which you have to commit manually.

                也许举个例子更清楚.这会将更改写入数据库:

                Maybe an example is clearer. This will write a change to the database:

                SET IMPLICIT_TRANSACTIONS ON
                UPDATE MyTable SET MyField = 1 WHERE MyId = 1
                COMMIT TRANSACTION
                

                这不会将更改写入数据库:

                This will not write a change to the database:

                SET IMPLICIT_TRANSACTIONS ON
                UPDATE MyTable SET MyField = 1 WHERE MyId = 1
                ROLLBACK TRANSACTION
                

                以下示例将更新一行,然后抱怨没有要提交的事务:

                The following example will update a row, and then complain that there's no transaction to commit:

                SET IMPLICIT_TRANSACTIONS OFF
                UPDATE MyTable SET MyField = 1 WHERE MyId = 1
                ROLLBACK TRANSACTION
                

                就像 Mitch Wheat 所说的,自动提交是 Sql Server 2000 及更高版本的默认设置.

                Like Mitch Wheat said, autocommit is the default for Sql Server 2000 and up.

                这篇关于如何在 SQL Server 会话中设置自动提交?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                上一篇:Sqoop:无法加载 mysql 驱动程序异常 下一篇:如何在 NHibernate 中进行嵌套事务?

                相关文章

                  <legend id='dUbE2'><style id='dUbE2'><dir id='dUbE2'><q id='dUbE2'></q></dir></style></legend>
                    <tfoot id='dUbE2'></tfoot>

                    • <bdo id='dUbE2'></bdo><ul id='dUbE2'></ul>

                    <small id='dUbE2'></small><noframes id='dUbE2'>

                    <i id='dUbE2'><tr id='dUbE2'><dt id='dUbE2'><q id='dUbE2'><span id='dUbE2'><b id='dUbE2'><form id='dUbE2'><ins id='dUbE2'></ins><ul id='dUbE2'></ul><sub id='dUbE2'></sub></form><legend id='dUbE2'></legend><bdo id='dUbE2'><pre id='dUbE2'><center id='dUbE2'></center></pre></bdo></b><th id='dUbE2'></th></span></q></dt></tr></i><div id='dUbE2'><tfoot id='dUbE2'></tfoot><dl id='dUbE2'><fieldset id='dUbE2'></fieldset></dl></div>