r.pezzolati
r.pezzolati

Reputation: 139

Cannot insert duplicate key row in object with unique index in SQL Server

Cannot insert duplicate key row in object 'dbo.OCRD' with unique index 'OCRD_ABS_ENTRY'. The duplicate key value is (1). The statement has been terminated.;

An error occurred while updating the entries. See the inner exception for details.; An error occurred while updating the entries. See the inner exception for details.

Inner Exception: Cannot insert duplicate key row in object 'dbo.OCRD' with unique index 'OCRD_ABS_ENTRY'. The duplicate key value is (1). The statement has been terminated.

An error occurred while updating the entries. See the inner exception for details. An error occurred while updating the entries. See the inner exception for details.

It's an insert on DB

Upvotes: 1

Views: 17471

Answers (2)

Zaynul Abadin Tuhin
Zaynul Abadin Tuhin

Reputation: 31993

follow what @Florian already said. Additional information

  • insert values into tables with out mentioning value to primary field

Upvotes: 1

Florian
Florian

Reputation: 11

  • You have a column named "OCRD_ABS_ENTRY" which has an integrity constraint (unique key or primary key).
  • You try to insert another entry with value "1" for OCRD_ABS_ENTRY column, which should be unique.
  • Try to delete the constraint if it's not necessary, or to insert with another value.

Upvotes: 1

Related Questions