I am using Linked server For transferring data using MSDTC
Alter Proc [dbo].[usp_Select_TransferingDatasFromServerCheckingforExample]
@RserverName varchar(100), ----- Server Name
@RUserid Varchar(100), ----- server user id
@RPass Varchar(100), ----- Server Password
@DbName varchar(100) ----- Server database
As
Set nocount on
Set Xact_abort on
Declare @user varchar(100)
Declare @userID varchar(100)
Declare @Db Varchar(100)
Declare @Lserver varchar(100)
Select @Lserver = @@servername
Select @userID = suser_name()
select @User=user
Exec('if exists(Select 1 From [Master].[' + @user + '].[sysservers] where srvname = ''' +
@RserverName + ''') begin Exec sp_droplinkedsrvlogin ''' + @RserverName + ''',''' + @userID +
''' exec sp_dropserver ''' + @RserverName + ''' end ')
declare @ColumnList varchar(max)
set @ColumnList = null
Select @ColumnList = case when @ColumnList is not null then @ColumnList + ',' + quotename(name) else quotename(name) end
From syscolumns where Id = object_id('Crnot') order by colid
Set identity_Insert Crnot On
exec ('Insert Into ['+ @RserverName + '].'+ @DbName + '.'+ @user +'.Crnot ('+ @ColumnList +') Select '+ @ColumnList +' from Crnot ')
Set identity_Insert Crnot Off
Exec sp_droplinkedsrvlogin @RserverName,@userID
Exec sp_dropserver @RserverName
when executing this qry i get the error "No transaction Active"