I have a query regarding Merge Replication.

I have 5 Tables.

  1. SetYarnMain Fields (MainId(PK), MainName, Comments)
  2. SetYarnSub (SubId(PK), SubName, MainId(FK), Comments)
  3. SetYarnDet (DetId(PK), DetName,SubId(FK),MainId(FK), Comments)
  4. SetYarnGrp (GrpId(PK), GrpName, DetId(FK),SubId(FK),MainId(FK), Comments)
  5. SetYarn (YarnId(PK),YarnName,GrpId(FK),DetId(FK),SubId(FK),MainId(FK),Comments)

These Tables doesnt have Identity Column

Lets take 2 tables SetYarnMain and SetYarnSub. I am generating a series in SetYarnSub Table with respect to SetYarnMain Table.
Let say MainId is 01 at Location A and at Location B.

If a user at Location B Inserts a row the SubId let say becomes 01001, but If a user at Location A Inserts a row then same Id is generated because the replication hasn't done yet.

When merge replication is performed table SetYarnSub at both location has 01001 id creates conflict in PK.

I need to know how to solve this problem.

Please if someone has the solution I humbly request to post it immediately.

Thanks and Regards

6 Years
Discussion Span
Last Post by adam_k

You can either use a uniqueidentifier to make sure that you don't have duplicate IDs in your tables or add the location in the id (01001A and 01001B).

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.