I'd like to create a trigger against an insert of a table in my database. So for example, if I have a company_name
table, I'd like to do the following:
company_name
table on server Acompany_name
on server A.Set identity_insert ON
on the company_name
table in server Bcompany_name
table on server B.The linked server can be referred to as [ServerB].[ServerB-Database].dbo.company_name
.
This is a requirement due to data hosting restrictions of clients in different countries.
One problem is the lag and connection between countries A and B.
While the remote insert happens, the local transaction is still running. This reduces performance and increases blocking.
The remote server could be unavailable too. Or take too long to respond. You can code the trigger to not fail but then you have inconsistent data.
Finally, if there are inserts on the remote server you have a multi-master problem.
I would really consider a solution like replication to publish the data to another server. Or consider using service broker to decouple local and remote inserts.