Solved

Cannot add a record to SQL 2005

Posted on 2008-10-29
2
432 Views
Last Modified: 2008-10-29
Try to add a record to a table but encounter error, with the message below.

Violation of PRIMARY KEY constraint 'PKPM00400'. Cannot insert duplicate key in object 'dbo.PM00400'.
The statement has been terminated.

Bascially, I have tried to use the key fields to select a record on the table but no records is retrieved. However, it pop up with the error when I add the records on it.

0
Comment
Question by:AXISHK
2 Comments
 
LVL 49

Accepted Solution

by:
Ryan Chong earned 300 total points
Comment Utility
is your Primary Key an auto-incremental field? If it's an auto-increment field, you can omit it in your insert sql statements.
0
 
LVL 8

Assisted Solution

by:rpkhare
rpkhare earned 200 total points
Comment Utility
I suspect you are attempting to insert duplicate primary key value. Check which column you have defined Primary Key and see that unique values are inserted into it.
0

Featured Post

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Join & Write a Comment

Introduction SQL Server Integration Services can read XML files, that’s known by every BI developer.  (If you didn’t, don’t worry, I’m aiming this article at newcomers as well.) But how far can you go?  When does the XML Source component become …
If you find yourself in this situation “I have used SELECT DISTINCT but I’m getting duplicates” then I'm sorry to say you are using the wrong SQL technique as it only does one thing which is: produces whole rows that are unique. If the results you a…
Via a live example, show how to extract information from SQL Server on Database, Connection and Server properties
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now