delete all records and reset autonumber fields
| User, date | Message |
|---|---|
|
Written by afal3d
2 years ago Category: General 14 posts since Wed, 06 Jul 11 |
How can I delete all records in my database and reset the AutoNumber field in a single command? |
|
Written by ansgar
2 years ago 3960 posts since Fri, 07 Apr 06 |
Well you need two commands, not one: TRUNCATE mytable; |
|
Written by csiqojerncjsa
2 years ago 9 posts since Sun, 10 Jul 11 |
As far as i know TURNCATE TABLE resets the AUTO_INCREMENT value. Cheers Robert |
|
Written by csiqojerncjsa
2 years ago 9 posts since Sun, 10 Jul 11 |
From MySQL 5.0.13 on, the AUTO_INCREMENT counter is reset to zero by TRUNCATE TABLE, regardless of whether there is a foreign key constraint. |
|
Please login to leave a reply, or register at first. |