troubleshooting Question

SQL Server 2005: Transaction context in use by another session error

Avatar of groston
groston asked on
Microsoft SQL Server
5 Comments1 Solution9309 ViewsLast Modified:
The problem described occurs under SQL Server 2005. This problem did not exist using SQL Server 2000.

My production environment has two computers, each of which is running an instance of SQL Server. On Machine1 (which has database1), I created a linked server which allows me to execute stored procedures on Machine2 (which has database2).

For development purposes, I need to 'simulate' this environment on my single development computer. Thus, I did the following (using the SQL Server 2005 syntax):

EXEC sp_addlinkedserver
   @server='Machine2',
   @srvproduct='',
   @provider='SQLNCLI',
   @datasrc='Machine1',
   @catalog='database2'

This works, in the sense that I can query against the linked server.

The problem is this: In database1, I have a stored procedure that does this following:

INSERT #tmp
EXEC [machine2].dbo.stored_procedure

This fails with a "Transaction context in use by another session." error.

I did some googling and found the following:
[this] doesn't work when the remote SP is executed against a loopback server.

So, my questions are these:
1) I am correct in assuming that by 'loopback server', the author of the comment means essentially what I did? (i.e., the 'remote' server is really the same as the 'local' server)
2) Assuming his statement is true, what options do I have? (other than checking the server name in the SP and reacting according. Of course, this is not practical because we have multiple developers, each with different computer and different database instance names who need to use the same stored procedures.)

Thank you kindly for your assistance.
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 5 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 5 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros