Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 How to create a trigger to update data in another

Author  Topic 

prettyjenny
Yak Posting Veteran

57 Posts

Posted - 2013-05-16 : 09:27:52
Hello,

I am new to creating a trigger in sql server so I need your help.

I have 2 sites, 2 databases (same name) on 2 different servers, S1 & S2. These database are the same name, tables, data, 100% the same.

I am using ASP to code. Currently, I have to enter data for each website, which is 2 times.

How can I create a trigger so that everytime there is an update in database in Server1, then the database in Server2 gets updated.

Thank you very much!

MuMu88
Aged Yak Warrior

549 Posts

Posted - 2013-05-16 : 10:34:07
Refer to this:
http://stackoverflow.com/questions/592280/trigger-to-update-data-on-another-sql-server
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2013-05-17 : 00:05:22
why not simply apply replication if attempt is to keep both databae objects in sync?

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs
Go to Top of Page

jackv
Master Smack Fu Yak Hacker

2179 Posts

Posted - 2013-05-17 : 01:55:15
Triggers utilised in this style - could cause all sorts of problems. The most obvious one being integrity of data\troubleshooting .
Couldn't you operate 1 database server? ,

Jack Vamvas
--------------------
http://www.sqlserver-dba.com
Go to Top of Page

Ifor
Aged Yak Warrior

700 Posts

Posted - 2013-05-17 : 06:08:23
Depending on what you want, another approch is to use the Service Broker. The following should give you an idea:

http://diegworld.blogspot.co.uk/2010/03/asynchronous-triggers-using-sql-broker.html

http://stackoverflow.com/questions/7271922/sql-server-trigger-an-asynchronous-update-from-trigger
Go to Top of Page
   

- Advertisement -