SQL Server Performance

Subcriber error: Violation of PRIMARY KEY constraint 'constraint_name'. Cannot insert duplicate key in object 'tableName'.

Discussion in 'SQL Server 2005 Replication' started by Megan, Dec 22, 2008.

  1. Megan New Member

    I was able to setup Transactional queued replication between 2 databases. I'm using SQL Server 2005 Standard edition. The Replication was setup through the wizard. In the database, there are 3 tables - Customers, Contact and ContactPhone. Creating a new customer will also create a contact and contact phone record.
    Each table has it's own IDENTITY column, increment of 1
    The customerID is a foreign key in the Contact table
    The contactID is a foreign key in the ContactPhone table
    Inserting a new record in the Publisher works fine. Synchronization works fine. However, when I try to insert a new customer in the Subscriber, I get the following error:
    Violation of PRIMARY KEY constraint 'constraint_name'. Cannot insert duplicate key in object 'tableName'.
    I've checked the article's property - Identity Range Management and it's set to Automatic.
    What do I need to do to get this working? Do I need to change the Publisher and Subcriber Range size?
    I thought SQL Server takes care of this, is that not true?

    Any help will be greatly appreciated.
    Thank you.
  2. ndinakar Member

    Generally I have seen people disable foreigh key constraints on subscribers since its used for mostly reporting and the data comes from publisher where its already validated.
  3. Megan New Member

    But I'm using transactional queued replication which means users will be updating the subscriber if and when the publisher is down. The updated data will then be moved into the publisher when it comes back online. From the documentation, that's what I understood the transactional queued replication would do. Am i missing something?
    Thank you for your help.
  4. ndinakar Member

Share This Page