insert exec opendatasource error 7391

1

Good morning,

I run this code in a database sql server 2008 R2, domain DBDS1 to another database sql server 2012 domain coms1 and it throws me a table with the data correctly.

EXEC OPENDATASOURCE ('SQLOLEDB','Password=6tgfjsoeuW.;Persist Security Info=True;User ID=usr_test;Initial Catalog=BDDEV;Data Source=10.163.37.131')
.DOCBASE3.dbo.Sp_ReporteCumplimiento 
        4,
        '',
        '',
        @FechaInicial,
        @FechaFinal,
        '8600343137',
        '',
        '',
        '',
        ''

The problem is that when before the EXEC I place the sentence insert into @tablaTemporal I get the following error message:

  

OLE DB provider "SQLNCLI10" for linked server "(null)" returned   message "No transaction is active.". Msg 7391, Level 16, State 2,   Procedure Sp_Report Compliance, Line 96 The operation could not be   performed because OLE DB provider "SQLNCLI10" for linked server   "(null)" was unable to begin a distributed transaction.

But if I do the same process: an insert to a temporary table, a table instead of a stored procedure, it does not generate an error, it does the insert correctly and then I select my temporary table and everything is perfect. Only error occurs when I combine the result of an exec that points to a stored procedure.

The two servers are in different domains, both have DTC configured. It works queries to tables, it works insert to temporary table of remote table, but insert of sp does not work. What can it be?

    
asked by Carolina 04.09.2018 в 19:02
source

1 answer

-1

Do you have the servers linked? if not, you could try linking the servers and run the insert similar to this

Insert into Tabla
EXEC [10.163.37.131].DOCBASE3.dbo.Sp_ReporteCumplimiento 
        4,
        '',
        '',
        @FechaInicial,
        @FechaFinal,
        '8600343137',
        '',
        '',
        '',
        ''
    
answered by 06.09.2018 в 01:18