[PHP] Anyway to reset MySql's AUTO_INCREMENT counter?
Hi. Usually, Any AUTO_INCREMENT field in MySql table will have always an incrementing value. Now Suppose I emptied the table and then inserted one record, why not this record LAST_INSERT_ID is not '1' or '0' and why it is the lastid+1 before I empty the table? Can't I reset that pointer w/ deleting the table and creating it again? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Anyway to reset MySql's AUTO_INCREMENT counter?
On Thu, 26 Jul 2001 19:13, elias wrote: Hi. Usually, Any AUTO_INCREMENT field in MySql table will have always an incrementing value. Now Suppose I emptied the table and then inserted one record, why not this record LAST_INSERT_ID is not '1' or '0' and why it is the lastid+1 before I empty the table? Can't I reset that pointer w/ deleting the table and creating it again? This is the php list, not the mysql list :-) Again from the mysql manual (you should get a copy) If you delete the row containing the maximum value for an AUTO_INCREMENT column, the value will be reused with an ISAM, GEMINI or BDB table but not with a MyISAM or InnoDB table. If you delete all rows in the table with DELETE FROM table_name (without a WHERE) in AUTOCOMMIT mode, the sequence starts over for all table types. -- David Robley Techno-JoaT, Web Maintainer, Mail List Admin, etc CENTRE FOR INJURY STUDIES Flinders University, SOUTH AUSTRALIA You look like something the cat refused to drag in. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Anyway to reset MySql's AUTO_INCREMENT counter?
So sprach »elias« am 2001-07-26 um 11:43:36 +0200 : Can't I reset that pointer w/ deleting the table and creating it again? Yep, DELETE FROM Table instead of dropping it. Or did you mean w/o? ALTER TABLE Table auto_increment=234; Alexander Skwar -- How to quote: http://learn.to/quote (german) http://quote.6x.to (english) Homepage: http://www.digitalprojects.com | http://www.iso-top.de iso-top.de - Die günstige Art an Linux Distributionen zu kommen Uptime: 3 days 18 hours 14 minutes -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]