iam using sql server 2014 on windows 8.1 pro
and calling a procedure that calls a dynamic linked server query inside trigger
(i will not put the complete code but consider it as an algorithm
CREATE PROCEDURE DynamicLinkedQuery(@InstanceName NVARCHAR(32),@DatabaseName NVARCHAR(64),@SchemaName NVARCHAR(64), @TableName NVARCHAR(64))
as
begin
declare
@SqlQuery NVARCHAR(MAX)
Select @SQlQuery='INSERT INTO ['+ @InstanceName+ '].['+@DatabaseName+'].' + @SchemaName + '.' + @TableName + ' Values(3)'
--assuming we have one int columns in destination table
EXECUTE sp_Executesql @SQLQuery
End
because i'm using dynamic linked server query it is considered as distributed query
so we have to run Distributed Transaction Coordinator service on both two linked servers
and of course configuring it first with following steps mentioned in this link
but iam still getting the error
OLE DB provider "SQLNCLI11" for linked server "ServerName" returned message "No transaction is active.".
but when i execute a non dynamic query like
INSERT INTO RemoteServerName.RemoteDataBaseName.RemoteSchemaName.RemoteTableName values(1,1)
every thing is ok and the operation is done
what can be the reason please and what are my missed configurations in LocalDtc
i applied this solution
Linked servers SQLNCLI problem. "No transaction is active"
but it never worked for me