- For individual users
- Instant access to solutions
- Ask your tech questions
- Start your 30-day Free Trial
Main Topics
Browse All TopicsHi
I have two database servers having Sql Server 2005 installed.
Sql Server 2005 version: Microsoft SQL Server 2005 - 9.00.3077.00 (Intel X86) Standard Edition on Windows NT 5.2 (Build 3790: Service Pack 2)
I have set up the Merge Repliaction between two servers. I have one publisher and one subscriber. Replication is bi-directional.
In both publisher and subscriber, i have one column that is set as primary key, identity and replication set to yes. Also automatic identity management is enabled.
Publisher: ([DocID]>(682157) AND [DocID]<=(683157) OR [DocID]>(684157) AND [DocID]<=(685157))
Subscriber: ([DocID]>(681157) AND [DocID]<=(682157) OR [DocID]>(683157) AND [DocID]<=(684157))
I am getting the errors while inserting data. This error is not coming all the time:
Error1: Unable to execute stored procedure INSERT_DOC
(System Error: Unable to execute query. Violation of PRIMARY KEY constraint 'PK_ReadDoc'. Cannot insert duplicate key in object 'dbo.ReadDoc'.)
Error2: Unable to execute stored procedure INSERT_DOC. (System Error: Unable to execute query. The insert failed. It conflicted with an identity range check constraint in database DOC replicated table 'dbo.ReadDoc', column 'DocID'. If the identity column is automatically managed by replication, update the range as follows: for the Publisher, execute sp_adjustpublisheridentity
Please let me know how to fix Error1 and Error2.
Thanks
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Business Accounts
Answer for Membership
by: TAB8Posted on 2009-09-28 at 21:12:59ID: 25445951
It looks like you have the same value pk that is trying to insert itself again ..
range as suggested in the error message contained in you error 2.
what you need to do is re-run the snapshot job and re-sync the subscription before you do this you should
sp_adjustpublisheridentity
Personally I manage my identity ranges manually for replication .. ie 10000000 for the publisher and 40000000 .. this just ensures that you dont have issues like this one