Solved

Cannot add a record to SQL 2005

Posted on 2008-10-29
2
434 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 50

Accepted Solution

by:
Ryan Chong earned 300 total points
ID: 22838391
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
ID: 22838478
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

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
SqlServer no dupes 25 34
sql server insert 12 30
Need help how to find where my error is in UFD 6 26
Alternative of IN Clause in SQL Server 3 17
Load balancing is the method of dividing the total amount of work performed by one computer between two or more computers. Its aim is to get more work done in the same amount of time, ensuring that all the users get served faster.
The Delta outage: 650 cancelled flights, more than 1200 delayed flights, thousands of frustrated customers, tens of millions of dollars in damages – plus untold reputational damage to one of the world’s most trusted airlines. All due to a catastroph…
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.

786 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