I have 2 databases(A) with same name in different servers( B & C). Both the databases have same schema. (sql server 2008 r2)
Task 1: Copy(transfer) both the databases into 3rd server (D) with the names (A_B and A_C).
Task 2: Merge both the databases into one database(A_D). (I don't know how will I handle keys)
Task 3: On daily basis I have to get data from servers B & C and put in centralized server D.
Any help would be appreciated.
Thanks.
Ritesh
 
                        
Here are a few ideas:
Task 1: Transfer databases by doing a backup an restore to server D.
Task 2: I think this will involve ETL processes and creating new surrogate keys in database A_D. Keep keys from original source in a data source id column. I think a MERGE statement would be helpful.
Task 3: Leverage logic in Task 2
Update for Task 2:
Say a source
Table1in database A and B has an key column namedTable1_ID. In database A_D add columnsTable1_SourceIDandTable1_Source. PopulateTable1_SourceIDwith the key from source database, and useTable1_Sourceto indicate the source database.Use
Table1_IDas the key forTable1, and is unique to database A_D. This will account for collisions for key columns in the source databases. Also, you can track the row to the source database.