I am trying to design a database structure. It will be installed into a few instances of sql servers. I need to merge these databases periodically.
Problem is in server_A (PK)id=222 user=Tom, but in server_B (PK)id=222 user=Peter.
So, in server_A for Tom, (FK)userid=222, Address=1 abc street…, but same (FK)userid=222 in server_B address table has a different meaning.
All I can think of is this cheap approach. If I have 3 servers, I seed the id in 1st server to start at 1000000001, 2nd server at 2000000001, 3rd at 3000000001 …. so they will not repeat themselves, that might work for a small time project? And I don’t need to use a Guid/uniqueidentifier to further complicate the problem?
What is a common/correct approach to this situation?
You can add a
server_idas a foreign key that’s now part of a compound primary key together with the original primary key. Each server has its own id.