The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
Updating Primary auto increment table.
How can I reset an autoincrement database table to rebuild it's numbers?
Here's the scenario: I have a database table with 118 rows. Due to testing the first 82 rows are gone. So I want to reset the autoincrement field for all rows - 82 so row 83 is numbered 1, 84 = 2, 85 = 3 and so on. I tried UPDATE autoincrement SET autoincrement = (autoincrement - 82) but that doesn't seem to work. I'm guessing maybe because the autoincrement field is the primary key for the database. I know I could change these all manually... but can't it be done with one simple query? Thanks |
#2
|
||||
|
||||
Quote:
As far as i know, you would need to drop the table make it again, then reimport your data and make sure the data was imported with the proper id's and not their old numbers ect. |
#3
|
||||
|
||||
You could take away the auto_increment. Go and change all the values and then change it back?
|
#4
|
|||
|
|||
Thanks guys. I'm discovering the same thing. they can be edited manually but a query won't function.
|
#5
|
|||
|
|||
here a way
hmm you can a temp table with auto increment and just read from old and inset into new 1 then delete old table and recreat it and do the progrees again way 2 : PHP Code:
way 2 is better. |
#6
|
|||
|
|||
Thanks miz.. I'll try that.
|
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|