SQL Automatic transactions, hidden transactions, explicit transactions, and transactions in. net

Source: Internet
Author: User

Http://www.cnblogs.com/procoder/archive/2009/10/06/1578346.html
Refer:

Transaction type of SQL Server 2008

1. automatically submit the transaction autocommit transactions

This is the default transaction type of SQL Server. Each SQL statement (SQL statement) is a separate transaction, which is automatically submitted after the statement is executed. The caller does not need to manually control the transaction process.

2. Display transaction explicit transactions

The caller needs to call the API or use the begin transaction statement of the T-SQL to open the transaction. You need to call commit or rollback transaction to submit or roll back.

3. Implicit Transaction implicit transactions

Use set implicit_transactions on to change the transaction mode to the implicit mode. The caller does not need to execute the begin transaction statement to open the transaction. The database engine automatically opens transactions when executing SQL statements. The caller needs to call commit or rollback transaction to submit or roll back. When the database engine executes the next SQL statement, a new transaction is automatically opened.

Reference: controlling transactions (database engine)

Pb: When autocommit is set to false, the emplicit transactions transaction is started. One transaction is followed by one transaction to form a transaction chain (you can see the implicit_transactions on setting through SQL Profiler ).

In. net, the so-called implicit transaction (transactionscope) display transaction (committabletransaction) is different from the transaction in sql2008, because only the following settings are seen through SQL profiler:

-- Network protocol: LPC
Set quoted_identifier on
Set arithabort off
Set numeric_roundabort off
Set ansi_warnings on
Set ansi_padding on
Set ansi_nulls on
Set concat_null_yields_null on
Set cursor_close_on_commit off
Set implicit_transactions off
Set language Simplified Chinese
Set dateformat ymd
Set datefirst 7
SET transaction isolation level read committed

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.