|
|
|
Re: Updating a primaty key and reflecting the changes to foreign keys. [message #224801 is a reply to message #224664] |
Thu, 15 March 2007 09:28 |
Bill B
Messages: 1971 Registered: December 2004
|
Senior Member |
|
|
A way to do this would be to insert a duplicate row except for the primary key column
insert into my_table(col1,col2,col3)
select 23,col2,col3,col4
from my_table
where col1 = 22;
Then alter the child table rows
update my_table_child
set col1 = 23
where col1 = 22;
then drop the parent key
delete from my_table
where col1 = 22;
commit;
|
|
|
|