0
Good afternoon!
How do I create a trigger that uses a Linked Server to insert the INSERTED data in another table that is in another database, this in another server?
Trying to Exemplify:
CREATE TRIGGER [TESTE] ON [TABELA_XYZ]
AFTER INSERT
AS
BEGIN
INSERT INTO LINKSERVER.BD.DBO.TABELA_ABC (CAMPO1, CAMPO2)
SELECT CAMPOA, CAMPOB FROM INSERTED
END
With this same "Trigger" I was able to insert the data of this table in another table of the same server/ bank, but when I try to use Linked Server is giving this error:
OLE DB provider "SQLNCLI11" for linked server "DMPAP8" returned message "The partner transaction manager has disabled its support for remote/network transactions.".
Msg 7391, Level 16, State 2, Line 2
The operation could not be performed because OLE DB provider "SQLNCLI11" for linked server "DMPAP8" was unable to begin a distributed transaction.
The two banks are SQL Server 2012, but are on different servers, Server and Server, and I need to copy from server B to A and table XYZ to ABC.
Any doubt I’m available.
to synchronize tables between different instances there are other less risky methods than trigger procedure that uses server binding (Linked server). Evaluate, for example, the use of some kind of replication or even a job sync from time to time.
– José Diz
Was any of the answer helpful? Don’t forget to choose one and mark it so it can be used if someone has a similar question!
– Sorack