Hello,Thanks for your help guys , it works great when I run it as a single the query (I gave a shot the OPENDATASOURCE command). But it is crashing when I try to insert same data inside a trigger.Here's the code simplified:CREATE TRIGGER [mytrigger]ON [dbo].[table1]FOR INSERTASBEGIN BEGIN TRY INSERT OPENDATASOURCE('SQLNCLI', 'my_connection').[Database].[dbo].[InsertedTable]([col1], [col2], [col3], [col4], [col5], [col6]) SELECT t1.col1, t1.col2, t1.col3, t2.col4, t2.col5, NULL AS col6 FROM table1 t1 INNER JOIN table2 t2 ON t1.col1=t2.col1 INNER JOIN inserted i ON t1.col1 = i.col1 WHERE t1.mycondition = my_value END TRY BEGIN CATCH IF ERROR_NUMBER() = 515 BEGIN PRINT ' HAY ALGUNAS COLUMNAS QUE NO ADMITEN NULOS: ' + ERROR_MESSAGE() END ELSE IF ERROR_NUMBER() = 8152 BEGIN PRINT ' SE HA SOBREPASADO EL MAXIMO DE UN CAMPO: ' + CONVERT(VARCHAR(10),ERROR_NUMBER()) + ' ' + ERROR_MESSAGE() + ERROR_MESSAGE() END ELSE BEGIN PRINT 'TENEMOS EL ERROR NUMERO:' + CONVERT(VARCHAR(10),ERROR_NUMBER())+ ' ' + ERROR_MESSAGE() END END CATCHEND
The error that throws me is something like this:Err=5 The transaction ended in the trigger. The batch has been aborted8501 MSDTC on server "myserver" is unavailable.The strange thing is that if I select the "INSERT part" and execute it, works perfectly..even if there are 10k rows.The same error is thrown everytime the trigger is fired. Do you guys know why? how can I solve that part?