Need some help on the below issue:
Case 1 : stored procedure is on server 1 - call is from server1
declare @tempCountry table (countryna
You have (I believe) two options here:
To try to avoid the usage of MSDTC
(and all these not pleasant things related to Distributed Transactions) by using OPENQUERY rowset function
/assume (here and below) that [database2_server2] is the name of the linked server/
declare @tempCountry table (countryname char(50))
insert into @tempCountry
select * from openquery([database2_server2], '[database1_server1].[dbo].[getcountrylist]')
select * from @tempCountry
OR
You can set the linked server's option Enable Promotion Of Distributed Transaction
to False
in order to prevent the local transaction to promote the distributed transaction and therefore use of MSDTC:
EXEC master.dbo.sp_serveroption
@server = N'database2_server2',
@optname = N'remote proc transaction promotion',
@optvalue = N'false'
and your original query should work fine:
declare @tempCountry table (countryname char(50))
insert into @tempCountry
exec [database2_server2].[database1_server1].[dbo].[getcountrylist]
select * from @tempCountry