• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 442
  • Last Modified:

Cannot add a record to SQL 2005

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
AXISHK
Asked:
AXISHK
2 Solutions
 
Ryan ChongCommented:
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
 
rpkhareCommented:
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

Become an Android App Developer

Ready to kick start your career in 2018? Learn how to build an Android app in January’s Course of the Month and open the door to new opportunities.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now