|
Posted by Rik on 07/25/07 13:52
On Wed, 25 Jul 2007 15:44:01 +0200, zach <wackzingo@gmail.com> wrote:
> Is there a way to sort all the data in my database such as alphabetical
> or something, and then once sorted and have all the primary key's redone
> according to the sorted order? I can sort them how I want, but I don't
> know if there is a way to rename the primary id key on all the data once
> sorted.
I guess:
1. Add a field for new primary key.
2. Update using an order by close and a counter.
3. Drop primary key.
4. Create primary key on new field.
5. Possibly drop old field & rename new field. (ALTER TABLE tbl_name
CHANGE old_col_name column_definition )
However, unless your data is static, I'd think doing this is futile. Why
do you need it?
--
Rik Wasmus
Navigation:
[Reply to this message]
|