How to Update foreign key values

How to Update foreign key values

  

Hi All,

  When i try to Update Foreign key value as zero database throws following error,Only values Present in Primary table i can able to update.My scenario is that i need to remove foreign key value of a particular record,How its Possible,whether we need to change delete rule of foreign key value to delete or ignore

Thanks,

R.karthik

Hi Karthik,

You need to check if the column User extension is set as mandatory. If it's mandatory you can't set it to zero.

Regards,

Marcelo


Hi Marcelo,

                  Thanks for your Reply, I have checked the thing you said,field of that entity user extension is not a mandatory field in our database.Only delete rule is in Protect


Thanks,

R.karthik

Solution

Hi Karthik, 

Try to change your query to set ParentId = null instead of ParentId = 0.

0 is a valid Id that doesn't exist in the parent table. 


Regards, 

Lennart 

Solution

Hi Lennart,

                     Thanks for your Solution,its working

Regards,

R.karthik