can we insert the value into linked server tables using trigger ?

  • i have two servers also i have same tables in both server.

    i want to replicate the values into another server when i inserted in my main server tables. for that i have written one insert trigger and tried to insert into linked server tables while trying to insert i am getting error.

    can any one tell me is it possible to insert the value into linked server tables using trigger ?

  • Yes, it is possible. I would not typically recommend it.

    A trigger is part of the original transaction. So, if your linked server is down or you have a packet lost your original transaction will fail and roll back. In addition, the original transaction needs to wait for the trigger to complete and inserting and updating a linked server is typically pretty slow.

    You may want to look into replication or service broker for what you are trying to do.

  • Thanks.

    I want to replicate the data to linked server.

  • Wouldn't a better way be to use the trigger to write to a transaction table, then to have a web service go through the transactions on a regular basis and process them?

    I've seen that done on a large Oracle based system

  • That is basically what Service Broker would do - without writing the code to manage the queues on both ends.

  • hi , i too also have same issue here,, i can do update or select but i want to do insert record in linked server talbe of same values for local table.. how can i pass the values to linked server.. plase tell me any eg of code... thanks a lot..

  • Please, please listen to Michael Earl. Look into Service Broker or just roll your own asynchronous solution. Also you could do SQL Server replication.

Viewing 7 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic. Login to reply