?
Solved

Cannot add a record to SQL 2005

Posted on 2008-10-29
2
Medium Priority
?
439 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 53

Accepted Solution

by:
Ryan Chong earned 1200 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 800 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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

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…
A Stored Procedure in Microsoft SQL Server is a powerful feature that it can be used to execute the Data Manipulation Language (DML) or Data Definition Language (DDL). Depending on business requirements, a single Stored Procedure can return differe…
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.
Using examples as well as descriptions, and references to Books Online, show the different Recovery Models available in SQL Server and explain, as well as show how full, differential and transaction log backups are performed
Suggested Courses

770 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