I'm trying to write a Trigger to copy data from a table on 'DB Server A' to an identical table on 'DB Server B'. The 2 servers are linked and i can manually run a query and it works fine. However the Trigger i wrote (adapted) doesn't show any errors, i'm looking to trigger it on 'Status' being changed to 'Live'.
Any ideas where i've gone wrong or should i be doing this another way?
USE [TestDB] GO /****** Object: Trigger [dbo].[Copy_Emp_DB_A_To_DB_B] Script Date: 08/23/2022 15:43:40 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO ALTER TRIGGER [dbo].[Copy_Emp_Svr_A_To_Svr_B] ON [dbo].[Employees] AFTER UPDATE AS BEGIN IF UPDATE(Emp_Status) BEGIN INSERT INTO DBServerB.TestDB.dbo.Employees (Emp_Title, Emp_FName, Emp_LName, Emp_Address1, Emp_Address2, Emp_Address3, Emp_Postcode) SELECT i.Emp_Title, i.Emp_FName, i.Emp_LName, i.Emp_Address1, i.Emp_Address2, i.Emp_Address3, i.Emp_Postcode FROM inserted AS i LEFT JOIN Deleted AS d ON i.Emp_TID = d.Emp_TID WHERE d.Emp_Status <> 'Live' AND i.Emp_Status = 'Live'; END END