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 Administration
 Mirror two tables

Author  Topic 

PaulC
Starting Member

4 Posts

Posted - 2010-07-21 : 03:43:01
Hi All,


Not sure if this is the place for this question but I had a search and can't find anything.


Basically what I am looking to do is create a new table using 3 fields from a database table I have already populated with data. I want to replicate any changes made to data in the 3 fields on the original table, and vice versa so the two tables are mirrored and up to date.


I hope that's easy enough to understand. Any help would be much appreciated.


Paul

aravindt77
Posting Yak Master

120 Posts

Posted - 2010-07-21 : 05:14:16
better to go for Trigger
Go to Top of Page

PaulC
Starting Member

4 Posts

Posted - 2010-07-21 : 05:42:40
Just basic update/delete/insert triggers? Would this make it more efficient?
Go to Top of Page

YellowBug
Aged Yak Warrior

616 Posts

Posted - 2010-07-21 : 08:15:35
Why do you want duplicate data?
Can you use a view instead?
Are the tables in the same database? Location?
Go to Top of Page

PaulC
Starting Member

4 Posts

Posted - 2010-07-22 : 03:04:05
No, the tables are in 2 seperate databases, That is why i want to duplicate the data as both tables are relating and fundamental to the functioning of 2 seperate systems.
Go to Top of Page

aravindt77
Posting Yak Master

120 Posts

Posted - 2010-07-22 : 04:06:31
if you mean is two way synchronization ..then suggest for a replication
Go to Top of Page

PaulC
Starting Member

4 Posts

Posted - 2010-07-22 : 05:52:12
Yeah two way synchonisation is exactly what I am needing. How can I set that up to replicate only a number of fields though and not all?
Go to Top of Page

aravindt77
Posting Yak Master

120 Posts

Posted - 2010-07-22 : 07:28:28
you can mention what all fields need to replicate , also specify what to do in any time similar records get update ..so that which one should retain like wise
Go to Top of Page

robvolk
Most Valuable Yak

15732 Posts

Posted - 2010-07-22 : 08:06:58
Are these databases on the same server? If so, create a view in the 2nd database that references the table in the other. Otherwise replication like aravindt77 suggested.
Go to Top of Page
   

- Advertisement -