0

We have 3 databases with same table but different data in them, on 3 servers, now we have a stronger server and we need to integrate 3 in 1. How can we have all data on one database? I have problem with relations of tables, if the primary key of a table change, what will happen with related table? How can I do this job without data loss? I'm not a DBA but I'm comfortable working with queries and such in SSMS. I'm the only one who updates the data.

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129

1 Answers1

0

Have you looked at the T-SQL Merge Function?

MSDN T-SQL Merge Function

This can be used to Sync data between multiple tables.

Don't forget you can access multiple databases in a single query by specifying the full path of the table - [Server\Instance].[Database].[Schema].[Table].

You must also preserve referential integrity by updating the Parent tables (Primary keys) first and then the Child Tables (Foreign keys) thereafter.

Phil T
  • 93
  • 8