...

View Full Version : mysql: AUTO_INCREMENT



Extreme43
06-15-2005, 08:33 AM
How would i reset the value, i have deleted every row but the id number still comes up as 300 or 301, 302 ect when i create a new row.
how would i make this 0 ?

Digger3000
06-15-2005, 08:41 AM
alter table (table name) drop column (id column)

alter table (table name) add column (id column) mediumint not null auto_increment

I type that a lot when people join my club twice.

Extreme43
06-15-2005, 08:55 AM
ok thanks ;)
but their isnt another way to do it without deleting the column?

Digger3000
06-15-2005, 08:56 AM
I don't think so.

delinear
06-15-2005, 09:24 AM
I believe you can specifically set the next auto-increment value using:


"ALTER TABLE $tbl_name AUTO_INCREMENT = $value"

Where $value is whatever you want the id to be, although I've not tried it myself :cool:

ClubCosmic
06-15-2005, 06:48 PM
i reset the auto inc value in phpmyadmin then looked at the code and this is what was returned:

$sql = 'ALTER TABLE tablename PACK_KEYS =0 CHECKSUM =0 DELAY_KEY_WRITE =0 AUTO_INCREMENT =1';

hope it helps
c.c.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum