If you are not using auto_increment for referential integrity, you could
dump your table structure,export all cols but your auto increment, drop your
table  and re-import your table structure and data.  Your idea should also
work if you run an ALTER TABLE and DROP INDEX first, then your UPDATE, then
re-apply the PRIMARY INDEX .

Either procedure is potentially dangerous and not recommended unless you
have a very compelling reason to do so or don't care about the underlying
data.

In any case perform a complete data dump on the table before trying either
method.

I hope this helps...

Pat...
[EMAIL PROTECTED]

----- Original Message -----
From: "Toni Viemero" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, July 05, 2002 6:04 AM
Subject: Fix holes in auto_increment field


> Hello,
>
> I've got test -table with id field as auto_increment int(11) and deleted
> some records from here and there.
> Is there some way to re-auto_inrement id field from zero to keep the id
> field running smoothly from 0-1000 without having "holes" in it?
> Some query like "UPDATE test SET id=NULL" (but that doesn't work :))
>
> --
> Toni Viemerö  |  http://selfdestruct.net
> "The ones who dont do anything are always the ones who try to pull you
>  down."
>
> ---------------------------------------------------------------------
> 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
>


---------------------------------------------------------------------
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