Joe writes:

> Is there a query I can run to change the next autoindex to the next highest 
> integer in the column.
> 
> I mean I have my userIDs, and they are autoincrementing. But if I have say 
> 9 users delete 5 of users, and then want to compact the table so that the 
> ids are all sequential. How can I make it so the next autoincrement starts 
> from say 5 instead of ten?

That's a stupid thing to do, since you'll break every foreign key
that refers to that table. If you really insist on breaking your
database, or if you only have a single table, delete the column
and recreate it. This of course will violate the uniqueness of
IDs over time, but if you have absolutely no reference to that
table that won't matter.

Generally doing something like this is useful only if you're
populating the database while you're developing it, and you
want to clean it up before it goes live.

//C

-- 
 Carl Troein - Círdan / Istari-PixelMagic - UIN 16353280
 [EMAIL PROTECTED] | http://pixelmagic.dyndns.org/~cirdan/
 Amiga user since '89, and damned proud of it too.

sql, database, anal-retentive filter

---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to