geometry

memo

バックアップから update 文生成

ちょっとヘマして area table の address column を全部書き換えちゃった。

スキーマを変更してしまっていて、insert into table select ... が使えないので update 文で更新する。
幸い areaOld table としてバックアップしておいたので、そこから update 文作成。

mysql -p <database> -se "select concat('update area set address=\'', address,'\' where id = ', id, ';') from areaOld;"
Enter password:
concat('update area set address=\'', address,'\' where id = ', id, ';')
update area set address='foo' where id = 1;
update area set address='bar' where id = 2;
...snip...

その内またやらかしそうなのでメモ。

mysql.txt · Last modified: 2008/04/22 16:47 by topaz2