Page 1 of 1

Need help with database structure. Really Need Help!

Posted: Mon Dec 09, 2002 12:37 am
by urb
I was wondering how to set a database table to where when i add a product to the table, the primary key named "id" with start at 0001 and auto increment up to 9999 at the max. So really I would like to know is how to get the "id" to start incrementing at 0001 if at all possible?


Thanks for your time

Matt Urban

aka -=urb=-

Posted: Mon Dec 09, 2002 12:49 am
by hob_goblin

Posted: Mon Dec 09, 2002 12:57 am
by dusty
ZEROFILL is what you need

Posted: Tue Dec 10, 2002 1:23 pm
by puckeye
And you configure your column to be smallint with 4 numbers. You'll have to take care of not going to 10000 because the records simply won't be saved in the DB.

I don't know how to reset the auto-increment to 0001 again though.

Puckeye

Posted: Tue Dec 10, 2002 2:02 pm
by JPlush76
ALTER TABLE orders AUTO_INCREMENT = 0001;