Skip to main content
Answer

Violation of PRIMARY KEY constraint 'UPHistory_PK'.

  • May 18, 2023
  • 3 replies
  • 266 views

Michael Ndungi
Varsity I
Forum|alt.badge.img

Hello everyone,
I’m trying to create a new instance of an existing database but I get an exception with the following error.

Kindly assist



Violation of PRIMARY KEY constraint 'UPHistory_PK'. Cannot insert duplicate key in object 'dbo.UPHistory'. The duplicate key value is (5).
The statement has been terminated.
 --------------------------------------
 Inner Exception:
 Violation of PRIMARY KEY constraint 'UPHistory_PK'. Cannot insert duplicate key in object 'dbo.UPHistory'. The duplicate key value is (5).
 The statement has been terminated.
 




​​​​

From the database this is how the situation looks like;
 



NB:database was moved to a different server.

​​Any kind of response will be highly appreciated

Best answer by Manikanta Dhulipudi

Hi @development93 

Thanks

3 replies

Naveen Boga
Captain II
Forum|alt.badge.img+19
  • Captain II
  • May 18, 2023

Hi @development93  Usually, we will get this issue when we try to insert the same details in the table, and due to key fields, it is throwing this error.

 


Michael Ndungi
Varsity I
Forum|alt.badge.img

Hi @development93  Usually, we will get this issue when we try to insert the same details in the table, and due to key fields, it is throwing this error.

 

since the table keeps history of application update.
would deleting the available data solve the issue?


Manikanta Dhulipudi
Captain II
Forum|alt.badge.img+15

Hi @development93 

Thanks