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

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

SQL Server Forums
Profile | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 How to create a trigger to update data in another
 Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

prettyjenny
Yak Posting Veteran

USA
57 Posts

Posted - 05/16/2013 :  09:27:52  Show Profile  Reply with Quote
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 - 05/16/2013 :  10:34:07  Show Profile  Reply with Quote
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

India
52326 Posts

Posted - 05/17/2013 :  00:05:22  Show Profile  Reply with Quote
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
Flowing Fount of Yak Knowledge

United Kingdom
2179 Posts

Posted - 05/17/2013 :  01:55:15  Show Profile  Visit jackv's Homepage  Reply with Quote
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 - 05/17/2013 :  06:08:23  Show Profile  Reply with Quote
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

Edited by - Ifor on 05/17/2013 06:09:27
Go to Top of Page
  Previous Topic Topic Next Topic  
 Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.22 seconds. Powered By: Snitz Forums 2000