changing value of a primary key in a table and FK in referenced tables

Posted by sergiogx on Stack Overflow See other posts from Stack Overflow or by sergiogx
Published on 2010-05-26T00:21:32Z Indexed on 2010/05/26 0:31 UTC
Read the original article Hit count: 196

Filed under:

I wish to change the primary key of a table, and also change the foreign key of the tables that reference it.

for example table employee has PK idEmployee = 1 table payroll has FK idEmployee = 1

I want to update employee to idEmployee = 2 and let the table payroll change FK idEmployee automatically.

is this posible in mysql?

thanks.

© Stack Overflow or respective owner

Related posts about mysql