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
 Trigger required to update one DB to another

Author  Topic 

Hutton782
Starting Member

2 Posts

Posted - 2011-02-08 : 06:09:34
Hi I'm really new to SQL so please excuse my question as it may be straight forward. I have a clear requirement described below.

I have one master database that needs to hold up to date details from several customer databases. How do I set this process up ?.

The databases are on the same sql server instance.

Example
DB1 (Master)
Table name "Customers"
Fields, "Support location" , "Custno", "Cust Name"

DB2 (Customer)
Table name "Support"
Fields, "Support location" , "Custno", "Cust Name" + more

What I need is to ensure that DB1 has an up to date list of all the Customers.

Can someone help me with the Sql required to set this up please ?

Lumbago
Norsk Yak Master

3271 Posts

Posted - 2011-02-08 : 06:52:55
How many tables do you need to keep updated? All of them or only a few? If it's a lot or quite a few replication might be the best way to go. If it's only 2-3 tables then maybe some triggers would be the easiest. How many customer databases do you have?

- Lumbago
My blog-> www.thefirstsql.com
Go to Top of Page

Hutton782
Starting Member

2 Posts

Posted - 2011-02-08 : 06:57:06
Only the one table is to be updated. It is to hold a list of al the customers we have. The list is to reflect the current position of 3 fields listed. There are 4000 Customer Db's.

Thanks
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2011-02-08 : 09:46:41
what all data can change in table? whats the columns you use for relating the tables?

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

blindman
Master Smack Fu Yak Hacker

2365 Posts

Posted - 2011-02-08 : 12:01:05
Don't use triggers for exchanging data between databases.
Use SQL Server Replication for this.

________________________________________________
If it is not practically useful, then it is practically useless.
________________________________________________
Go to Top of Page

Lumbago
Norsk Yak Master

3271 Posts

Posted - 2011-02-09 : 03:04:34
Hutton: you say that you need "up to date" data from these databases...what does that actually mean? Does it mean real-time or can you get it say every hour or a few times a day perhaps? In general I agree with blindman that using triggers across database boundaries is generally not recommended, but setting up replication from 4000 databases seems very unpractical.

- Lumbago
My blog-> www.thefirstsql.com
Go to Top of Page
   

- Advertisement -