SQL Server Transaction Replication - Primary Key

0

I have an environment with 2 branches, each branch has to have an application server with a SQL SERVER installed, I configured the # that is working perfectly, however if 2 people in different branches are inserting data into the same table at the same time I get the primary key error violated.

I would like a configuration suggestion for this environment, I really need to keep a server in each branch so that the application stays fast.

Thank you!

    
asked by anonymous 18.02.2016 / 20:19

1 answer

1

Assuming you're using identity as a key.

My solution for you is to create a column (if it does not exist) that indicates which branch is saving data and change your table so that that column is also part of your key.

Another solution, but that only serves if it applies to your current environment with 2 branches would be to recreate the identity's in the tables so that one branch only had pairs id and the other only odd id's.

But I do not indicate this second option, for N reasons.

    
18.02.2016 / 22:09