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_proc
edure
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.
Start Free Trial