Duplicate entry for PRIMARY key

Calvince Ninga wrote on Wednesday Oct 11, 2017

Hello all,
please anybody help me correct this error in my system, its a reccurent error in my system, the possible solution
'Duplicate entry ‘64685’ for key ‘PRIMARY’.

@Calvince Ninga

The error has been generated is because there is already an existing value for the column ID in which you define it as PRIMARY KEY (values are unique) in the table you are inserting.
Can you provide more information like screen or the operation that creates the error, we hope a screenshot will helps us better.

Thanks,
ViSolve

Hello,
I’m faced with the same issue. We couldn’t create a new encounter and then this issue popped up. It’s complaining of duplicate primary key for form_encounter table and noticed the last entry is ID = 0. When we deleted that (as was for our test patient), it appears that did the same for the latest entry for that patient in forms table. When we deleted the patient tried to open new encounter on a real patient, same thing happened. On checking the table schema it seems that no issues easy identified and since working before with no table modifications not sure why that would be the etiology. Any advice would be greatly appreciated!

Jit What is the highest id in form_encounter?

Hi Jit Chawla,
Make sure form_encounter table column id primary key / autoincrement. I atteched here form_encounter table for your reference
form_encounter.sql (3.3 KB)

Thanks ,
Param,
help@capminds.com

Thanks guys! Working but the issue was that the doctor changed the data type of that column without telling anyone