SQL Server appears ' other session is using transaction context ' for the cause of the problem, what is a loopback linked server? (reproduced)

Source: Internet
Author: User
Tags management studio sql server management sql server management studio

I go through the Baidu search and test myself to get the problem reason:

On MSDN I read that SQL Server does not support the presence of a local linked server in distributed transactions (loopback linked server) by simply stating that you might not fully understand the meaning of the loopback link server . Just a few pieces of code down there, and you'll understand.

1. Open the native SQL Server Management Studio tool to connect to a database server

The native database server is used here.

2. The address of a linked server connection on the native database server is the native server with the name Ls_test.

3. Assume that the local database server has

Database A

Database b

Dbo.test table in database B

4. Create the following stored procedure in database a

CREATE PROCEDURE [dbo]. [prps_testa]  as SET  on BEGIN TRAN    EXEC Ls_test. B.dbo.prtestb    COMMITTRAN

5. Create the following stored procedure under database B

CREATE PROCEDURE [dbo]. [prtestb] @OV_ReturnMss VARCHAR (+) OUTPUT  as BEGIN            SELECT *  from Ls_test. B.dbo.testEND

6. Execute the stored procedure under database a Dbo.prtesta

EXEC dbo. Prtesta

The following error will appear:

The context of the transaction is being used by another session.

I believe you already understand what is called loopback link Server , when we change the dbo.prtestb of the stored procedure in database B to cross-library access, such as:

SELECT *  from B.dbo.test

The problem is solved.

Therefore, you must pay attention to avoid this problem in the future use of business, I hope to help you!

Original link

SQL Server appears ' other session is using transaction context ' for the cause of the problem, what is a loopback linked server? (reproduced)

Related Article

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.