Search the Blog

Monday, June 22, 2020

The INSERT statement conflicted with the FOREIGN KEY constraint Error Type - 547

We are going to resolve the following error-The INSERT statement conflicted with the FOREIGN KEY constraint


Error Description for The INSERT statement conflicted with the FOREIGN KEY constraint


Msg 547, Level 16, State 0, Procedure spMVC_Dizsweb_QAScore_InsertUpdate, Line 103 [Batch Start Line 0]
The INSERT statement conflicted with the FOREIGN KEY constraint "FK_DizswebQAScoreCardAnswer_DizswebQAScoreCardSubCategoryID".
The conflict occurred in database "Dizsweb_Test",
                                        table "dbo.DizswebQAScoreCardSubCategory",
                                        column 'DizswebQAScoreCardSubCategoryID'.

To resolve this issue Please follow the following steps

STEP 1:-

    Check the Foreign Key Constraints with the Help of  following Query

    sp_help  Object_name

Step 2:-

   Try to get the default value in foreign key
   Case1- May be it will NULL and you are passing other than NULL
   Case2- May be default is 0 are passing NULL
   Case3- Value passing may be not exists in the table
   Case4- Id removed from the table


Step 3-

  Change the default value to the value which u r  passing.


No comments:

Post a Comment

Translate