|
|||||||
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
#1 |
|
Member (8 bit)
Join Date: Apr 2004
Location: Phoenix
Posts: 223
|
reset autoincrement counter
In MySQL I set up a table with 5 columns (the number doesn't matter so much), the first one I have set to autoincrement. I have tested the table with INSERT and DELETE queries and have been successful with the tests. I've noticed, however, as the rest of you probably know, that even though I've deleted rows, the first column continues counting, even if the previous row was deleted.
i.e.: 1 row2 row3 row4 row5 3 row2 row3 row4 row5 4 row2 row3 row4 row5 6 row2 row3 row4 row5 How do I reset the counting, if possible?
__________________
"Advancement is answering the questions, discovery is questioning the answers." |
|
|
|
|
|
#2 |
|
Security Dude
Staff
|
The pure SQL statement:
PHP Code:
__________________
Tyler A. Thompson Small Business Networking Services Specialist tyler@derbydigital.com |
|
|
|
|
|
#3 |
|
Barefoot on the Moon!
Staff
Premium Member
Join Date: Aug 2002
Location: Northeastern USA
Posts: 13,385
|
Make sure there are no rows you do this, or if you do, change the 1 to one more than the highest row numbered.
__________________
There are two secrets to staying young, being happy, and achieving success. You have to laugh and find humor every day, and you have to have a dream.
|
|
|
|
|
|
#4 |
|
Member (8 bit)
Join Date: Apr 2004
Location: Phoenix
Posts: 223
|
For now I found a way to solve it is to delete the column that autoincrements and then readd it and have it autoincrement. If anybody has a simpler way to solve it feel free to share.
|
|
|
|
|
|
#5 | |
|
Staff
Premium Member
Join Date: Jul 1999
Location: Arlington, TN
Posts: 5,538
|
Quote:
__________________
Want to Make $$$$ with your Computer? No Risk! Simply press shift-4 four times in a row |
|
|
|
|
|
|
#6 |
|
Member (8 bit)
Join Date: Apr 2004
Location: Phoenix
Posts: 223
|
I did it before and it seemed to work. What's wrong with doing it that way? And no, the table is not empty, but I will make a note of the previous suggestion.
|
|
|
|
|
|
#7 |
|
Come in Ray...
Join Date: Sep 2004
Posts: 1,668
|
Why do you need to do this? Like Mairving said, it is generally not a good idea as only problems can occur.
|
|
|
|
|
|
#8 |
|
Member (8 bit)
Join Date: Apr 2004
Location: Phoenix
Posts: 223
|
When I tested it I didn't see any issues that happened. I would imagine similar procedures would be done for those online companies using databases for various features and later have to add columns for additional features that would affect every member of such sites. Correct me if I'm wrong about that.
|
|
|
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| password reset prevention | peekaboo | Networking & Online Security | 2 | 03-22-2006 11:28 PM |
| Need a simple counter | Byte 2.0 | Web Design / Development | 4 | 08-07-2005 01:19 PM |
| Telindus Router wont Reset. help! | tomert | Networking & Online Security | 2 | 03-28-2005 11:12 PM |
| reset switch | ROYP123 | Computer Hardware | 6 | 11-01-2004 10:49 PM |
| Motherboard has power and reset buttons onboard, but.... | AlwaysUp | Computer Hardware | 0 | 10-25-2003 05:08 AM |