SQL Server Table Trigger over two Database Server with the same Table Stucture

Copper Contributor

Hello I have a question
Is it posible to create a Trigger after Update to write the hole updated data to an identical sql server with the same table structur?

To describe this in more detail: Two database servers with identical tables. One Process writes data into Table 'A' and now I want that a trigger (after insert or after update) writes the same Data into table 'A' on the second database server, with the identical table with the same Structure and the same Login. Is this possible?

 

Greetings from Germany

Michael


Greetings from germany
Michael

1 Reply

@MichaelBurkhardt 

Yes. Please follow below step:

  1. Create Linked server and set "RPC" and "RPC Out" to "True" from "Security Option".
  2. Linked server user have insert access on table.
  3. Write four part naming while inserting data in trigger
INSERT INTO [LINKED-SERVER-IP].MyDb.dbo.Customer (CustomerId, CustomerName)
SELECT CustomerId, CustomerName FROM MyCustomers WHERE CustomerId = 5

    4. Enable Distributed transactions on server. 

https://dba.stackexchange.com/questions/218936/insert-trigger-to-a-linked-server-error