Salı, Ekim 16, 2012

Renumbering id field of a database table

For a database I needed to renumber the existing id fields. Without using any auxiliary scripting language, here is a way to do it in mysql: say you want to number the id field begining from index 1000,
set @count=999;
update table set id=@count:=@count+1;
as described in this page.

Hiç yorum yok: