At 17:56 +0400 8/27/03, Antony Dovgal wrote:
On Wed, 27 Aug 2003 09:38:16 -0400
Paul DuBois <[EMAIL PROTECTED]> wrote:

 At 9:05 -0300 8/27/03, bernardaum wrote:
 >Hi,
 >
 >I have a table with an auto_increment field. When I
 >delete all the record and insert a new one the
 >auto_increment field is not clean, its follows the
 >sequence.
 >
 >Can I restart this sequence? Start from 0 again?

 Why bother?  MySQL doesn't care if there are gaps in the sequence.
 And if you're using the ID to relate records in the table to records
 in another table, you'll destroy the correspondence.

imho, he's talking about resetting auto_increment to 0, not about gaps in ID:
When I --> delete all <-- the records ...

Second reason still applies.


If it's still something deemed desireable:

ALTER TABLE tbl_name AUTO_INCREMENT = 1;

(or 0, but sequences don't really begin with 0, they begin with 1. :-))


-- Paul DuBois, Senior Technical Writer Madison, Wisconsin, USA MySQL AB, www.mysql.com

Are you MySQL certified? http://www.mysql.com/certification/


-- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]



Reply via email to