List:General Discussion« Previous MessageNext Message »
From:Paul DuBois Date:January 8 2003 7:26pm
Subject:Re: Resetting the auto_increment to start from 1
View as plain text  
At 9:33 +0200 1/8/03, Octavian Rasnita wrote:
>Hi all,
>
>I've read the following in a MySQL book:
>
>   A special case of record deletion occurs when you clear out a table
>entirely using a DELETE with no WHERE clause:
>  DELETE FROM tbl_name;
>   In this case, the sequence counter may be reset to 1, even for table types
>for which values normally are not reused (MyISAM and InnoDB). For those
>types, if you wish to delete all the records while maintaining the current
>sequence value, tell MySQL to perform a record-at-a-time delete by including
>a WHERE clause that specifies some trivially true condition:
>  DELETE FROM tbl_name WHERE 1 > 0;
>
>---
>
>Well, I've tried that sql statement, but the auto_increment point of start
>was not reset to 1.

Note that the text in question says *may* be reset to 1.

To reset it for sure, use the statement at the top of page 558. :-)

>I use MySQL 4.05 under Windows 2000.
>
>Thanks.
>
>Teddy,
>Teddy's Center: http://teddy.fcc.ro/
>Email: orasnita@stripped


Thread
Resetting the auto_increment to start from 1Octavian Rasnita8 Jan
  • Re: Resetting the auto_increment to start from 1Paul DuBois8 Jan
  • Re: Resetting the auto_increment to start from 1iConnect \(Berlin\) Stefan Hinz8 Jan
    • Re: Resetting the auto_increment to start from 1Paul DuBois9 Jan
      • What's returned from $sth->execute(); ?Jeff Snoxell10 Jan
        • Re: What's returned from $sth->execute(); ?Paul DuBois10 Jan
  • Re: Resetting the auto_increment to start from 1Octavian Rasnita9 Jan
  • Re: Resetting the auto_increment to start from 1iConnect \(Berlin\) Stefan Hinz9 Jan
Re: What's returned from $sth->execute(); ?Rich Allen11 Jan