www.webdeveloper.com
Results 1 to 3 of 3

Thread: MySQL reseting AUTO INCREMENT KEY

Hybrid View

  1. #1
    Join Date
    Oct 2003
    Posts
    215

    MySQL reseting AUTO INCREMENT KEY

    Using MySQL for database management for a website (which uses php to connect to MySQL).

    I have a table with one key value, that goes up by one everytime a record is created. Say I have a total of 3 reconds (index 1, 2, 3) and delete record 3 (index 3) when i create a new table the new index is 4. How can I have it start at the lowest index value?

  2. #2
    Join Date
    Aug 2003
    Location
    In my house
    Posts
    4,004
    I'm not sure how efficient (or inefficient) it is, but the only way I've found to reset it is to remove the field, then add it again. I haven't found any other way thus far, so that's how I've been doing it.
    Thousand different paths
    So many sterile ends
    I chose the Devil's path

    Never shall the sun kiss my face
    And caress me with it's burning light
    For I dwell in the shadows
    And sleep side by side with death

  3. #3
    Join Date
    Feb 2003
    Posts
    2,745
    ALTER TABLE tbl_name AUTO_INCREMENT = value

    ought to do it.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles