webguync Posted June 19, 2008 Share Posted June 19, 2008 Say you have a table with a field called ID set as Type(smallint), and set to auto increment. You have 10 entries, 1-10 in the ID field. You delete the entries, and start adding new ones. Even though there are currently no entries, the new additions will begin 11,12,13,14,15, and so on for the ID's. Is there a way to get the ID's to start over at 1 without manually going in to edit each one? Quote Link to comment Share on other sites More sharing options...
fenway Posted June 19, 2008 Share Posted June 19, 2008 Say you have a table with a field called ID set as Type(smallint), and set to auto increment. You have 10 entries, 1-10 in the ID field. You delete the entries, and start adding new ones. Even though there are currently no entries, the new additions will begin 11,12,13,14,15, and so on for the ID's. Is there a way to get the ID's to start over at 1 without manually going in to edit each one? Why does everyone want to do this? This is NOT a counter. This is a unique row identifier -- never to be re-used. Oh, and you'll kick yourself later for using SMALLINT -- use UNSIGNED INT instead. Quote Link to comment Share on other sites More sharing options...
webguync Posted June 19, 2008 Author Share Posted June 19, 2008 I don;t see an option for UNSIGNED INT. What is the advantage of using that? Quote Link to comment Share on other sites More sharing options...
Barand Posted June 19, 2008 Share Posted June 19, 2008 In round numbers [pre] +----------------+---------------+ | ID TYPE | MAX ROWS | +----------------+---------------+ | SMALLINT | 32,000 | | UNSIGNED INT | 4,000,000,000 | +----------------+---------------+ Quote Link to comment Share on other sites More sharing options...
webguync Posted June 20, 2008 Author Share Posted June 20, 2008 is UNSIGNED INT something new? I am not seeing that option in my version of PHPMYAdmin Quote Link to comment Share on other sites More sharing options...
fenway Posted June 20, 2008 Share Posted June 20, 2008 is UNSIGNED INT something new? I am not seeing that option in my version of PHPMYAdmin Um, no. Specify "INT", and then UNSIGNED somewhere. Quote Link to comment Share on other sites More sharing options...
webguync Posted June 20, 2008 Author Share Posted June 20, 2008 oh, in the attributes. I see, thanks Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.