Results 1 to 3 of 3
  1. #1
    Join Date
    Oct 2004
    Location
    In cousin's house
    Posts
    303

    Unanswered: how to reset autoincrement field

    hi,
    Im using innodb table type and I have an autoincrement field. I delete all my records but when i insert a new ones. the value is not returning to 1. My question is how to resel the value to 1?

    thanks,
    Popskie

  2. #2
    Join Date
    May 2005
    Posts
    127
    hi,
    DROP the field you are auto_incrementing. then ALTER the table to ADD the field again with the same attributes.
    Or use
    Code:
    ALTER TABLE yourTable AUTO_INCREMENT=1
    to delete all rows and reset the auto_increment use "TRUNCATE TABLE yourTable"

    --Regards
    Chagh

  3. #3
    Join Date
    Oct 2004
    Location
    In cousin's house
    Posts
    303
    thanks for ur prompt reply.

Posting Permissions

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