jakub78


Hello,

i have two server connected to internet S1 and S2 (connection between both is only internet too).

I need write trigger on S1 which send update or another command to S2. Is it possible, and how (without using .NET methods only by using Transact SQL)

Thnx, jakub.





Re: Trigger with access to remote server

Jens K. Suessmeyer


Setup a linked server on the server where youwant to place the trigger on and do your DMl operation on this using the syntax LinkedServer.database.objectname. As this is a distributed transaction you will need to have the MS DTC service running for providing concistency through the transaction.

HTH, Jens K. Suessmeyer.

---
http://www.sqlserver2005.de
---






Re: Trigger with access to remote server

jakub78

Can u show me good base of knowledge about this problem

I need know what happend when connection crashed, if server try make triger again after new connection, etc.

Best regards Jakub Kuzela.





Re: Trigger with access to remote server

Jens K. Suessmeyer

Do you need to execute the command on the linked server synchronously

HTH, Jens K. Suessmeyer.

---
http://www.sqlserver2005.de
---





Re: Trigger with access to remote server

jakub78

No, i need write it to S1 and than send to S2 fast as possible but not synchronously, i dont want wait on S1 until S2 have this information.

My scenario:
s1 get query for example update table1 set (col1) values (5)
s1 make this update and run triger on table1 for update and here i send this query to S2,

but link between s1 and s2 is not 100% sometimes there is 1-2miute of lost connection...

i want make something as small replication but i want updated only two columns and i hope trigger will be good and more simple solution.


Jakub.




Re: Trigger with access to remote server

Jens K. Suessmeyer

The scenario you described is actually synchronously, in addition if the Update trigger fails, the whole transaction will be rolled back (which you probably donˇŻt want). i would suggest using a table where you write the reference to the updated data on the table in S1. check this table in small intervals via a SQL Job and update the s2 server then.

HTH, Jens K. Suessmeyer.

---
http://www.sqlserver2005.de
---





Re: Trigger with access to remote server

jakub78

Hello again,

may be this is my basic nescience, but update and fired trigger on this update is always one (in this case distributed) transaction

best regards