I have two different database server on two different IP addresses. Say SERVER_1 and SERVER_2 (SQL Server 2012).
How to write trigger on table from SERVER_1 database and insert record in SERVER_2 table ?
I have two different database server on two different IP addresses. Say SERVER_1 and SERVER_2 (SQL Server 2012).
How to write trigger on table from SERVER_1 database and insert record in SERVER_2 table ?
Not sure why you want to use trigger to insert on different server,you also can use replication if you want to keep data upto date..The approach you are using has disadvantage,since for every insert ,this query has to insert on a different server..
if you want to use trigger,use it like below
create trigger trg_test
on dbo.yourtable
after insert
as
begin
insert into server2.databasename.schemaname.tablename
select * from server1.databasename.schemaname.table
end