The INSERT statement conflicted with the FOREIGN KEY constraint "OSFRK_OSUSR_U38_APPL

The INSERT statement conflicted with the FOREIGN KEY constraint "OSFRK_OSUSR_U38_APPLYJOBNEW_OSUSR_U38_CANDIDATE_CANDIDATEDETAILID". The conflict occurred in database "PNJHNU009", table "dbo.OSUSR_U38_CANDIDATE", column 'ID'. The statement has been terminated.

Hi Sourabh,

It looks like your OSFRK_OSUSR_U38_APPLYJOBNEW table has a field for CANDIDATEDETAILID. However, the CANDIDATEDETAILID you are trying to add is not found in your dbo.OSUSR_U38_CANDIDATE table. 


If you have not added the CANDIDATE  to the dbo.OSUSR_U38_CANDIDATE  table before adding a APPLYJOBNEW , the insert will fail with this error. If you insert the APPLYJOBNEW with no value in the candidateId field, this error will occur.


Best regards,

Yusuf Kerim

Hi Sourabh,

In your table OSFRK_OSUSR_U38_APPLYJOBNEW , it has a foreign key reference to another table. The way a FK works is it cannot have a value in that column that is not also in the primary key column of the referenced table.

You can check your database. See which column that FK is on, and which column of which table it references. You're inserting some bad data.

Let me know if you need a better explanation

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.