Back To Resources, Guides and Information

Reset Primary Key (ID) In Database

I've been asked this numerous times, so I decided to post it. If you are databasing and find yourself either clearing your table, or moving a databased program from site to site, you may notice that clearing the table out does not reset the PRIMARY ID (UNIQUE ID), also known as auto increment, number. Execute this SQL to reset that number. Of course, you can change the number 1 to whatever you would like. So, if you want your ID to start at 10,000 use 10000. Cheers!

[code]ALTER TABLE tablename AUTO_INCREMENT = 1

Comments

» No Comments have been made on this. How about you start us off?

Comment On This

Comments Have Been Disabled.

Browse By Category

Latest Posts

Advertising

© Max Morgan Design 2009 - 2012 | Page Generated In 0.17647 Seconds Using 34 MYSQL Queries