Jump to content


Photo

how do I reset the index (usernumber) that is autoincrement


  • Please log in to reply
4 replies to this topic

#1 eastcoastdubs

eastcoastdubs
  • Members
  • Pip
  • Newbie
  • 4 posts
  • LocationAllentown, PA

Posted 14 February 2003 - 01:23 AM

I am in the process of automating users profiles so they can log in and change their CAR information.

Since I am in the test phase I put random info in and everything works fine. My problem is that when I delete a record ( up to 17 so far from testing ) The autoincremented number keeps going from 17 to 18 and so on. How do I reset the indexes so it starts at 1 again?

Thanks
eastcoastdubs.com - the next generation of volkswagen enthusiasts

#2 effigy

effigy
  • Staff Alumni
  • Advanced Member
  • 3,600 posts
  • LocationIL

Posted 14 February 2003 - 02:03 AM

delete from table_name

wipes out all data and resets increment.
Regexp | Unicode Article | Letter Database
/\A(e)?((1)?ff(?:(?:ig)?y)?|f(?:ig)?)\z/

#3 MannX

MannX
  • Members
  • Pip
  • Newbie
  • 1 posts

Posted 16 February 2003 - 10:25 PM

Hi,

Maybe eastcoastdubs also needs to know how to make use of the blanked out record IDs.

Say for instance, if there is a table with 10 record rows and indexed between 1 to 10 . Then the whole record on index 5 row is deleted by DELETE FROM table_name WHERE id=\'5\'. Thus leaving the index 5 unused....

How to reuse this index 5? Anyone ?

MannX.. :roll:

#4 Centrek

Centrek
  • New Members
  • Pip
  • Newbie
  • 6 posts

Posted 25 February 2003 - 01:35 AM

k, i\'ve wanted to know how to do this for quite some time now.
I\'m gonna jump in here, hope someone can help us out.
568

#5 benW

benW
  • Members
  • PipPip
  • Member
  • 12 posts
  • LocationWaukesha WI

Posted 01 March 2003 - 12:49 AM

Why would you want to reuse a deleted key? Your request can not be done. There is no reason to delete a key and re create it. When you create an auto increment table it\'s use 99% of the time it\'s used as an easy way to do DELETE and UPDATE, SORT BY, (ASC, DESC) etc. SQL statements. Try to re think if you you really need to do these things. I\'ll bet not :)


<?php str_replace("ASP", "PHP", $str); ?>




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users