Home > database >  SQL server data interaction across an error: other session is using transaction context.
SQL server data interaction across an error: other session is using transaction context.

Time:10-30

1, now A, B two SQL server, the IP address 192.168.0.1 and 192.168.20.2, respectively, considering the mutual values, established A link to the server,
2, now has a more complex application, consider writing a stored procedure will data in later, to the front end program calls,
1), first in the server to perform A series of query;
2), and then by 'link to the server from the server to perform a series of B query;
[need A server queries as its condition, it is by 'link to the server again to A server in the query results];
3), the final will be A server query result and B returned from the server after the result of the combination, the final result to the front end program calls A server of the stored procedure;

Problem: front end program calls an error: other session the context with A transaction, the Microsoft distributed transaction coordinator (MS DTC) have to cancel the distributed transaction, [directly in the SQL stored procedure to perform A server is also OK]

Baidu to query the problem, which means the data circuit, the second action 'to' link to the server again to A server for the query results' block with respect to OK, but this is not the desired results, A great god, and of all stripes help this how to solve?

In A server before [don't know can query results into A temporary table, then the temporary table data as the second action, invoked by 'link to the server server B the parameters of the stored procedure to execute?]

CodePudding user response:

Eventually perform is performed on which server, look at the building Lord, is in B on the server by connecting to the server first to check the data on the server, and the results of A query on the server B as A condition to perform A query

Recommendation is A server query results in A temporary tables or variables inside, then queried on B server

The other submitted to the other session is using transaction context probably because the link server to query efficiency is too slow to cause a deadlock, then MSDTC automatically put you killed that process
  • Related