user710502
user710502

Reputation: 11469

Updating a field that is a foreign key to a parent table

I need to modify a the value of a field, but this field is a foreign key to a parent table.. How can I update that value since it is a foreign key?, its telling me it cant do it (and I see why) but what is the best way to do this?

UPDATE MANAGERS set SSN_MAN='888775555' where SSN = '665770000'

Now SSN_MAN is referencing SSN in the EMPLOYEE table, and SSN is a primary key in EMPLOYEE too. Any help would be much appreciated.

Thank you

Upvotes: 0

Views: 50

Answers (1)

Wael Dalloul
Wael Dalloul

Reputation: 23044

You can update the value of the foreign key, but this value should be exist in the Parent Table, otherwise you will lose your database integrity.

I meant the value '888775555' should be a value for one primary key in MANAGERS table.

Upvotes: 2

Related Questions