79577828

Date: 2025-04-16 18:04:28
Score: 1.5
Natty:
Report link

I had same issue; I tried with @variables and scripting successfully but finally the fastest way to me is:

1: add an "(int) value" column theintcolumn to the table yourtable
2: maybe you have to fill theintcolumn with zero values, if needed "update yourtable set theintcolumn=0;"
3: drop the primary key attribute of your previous primary key (thepreviouskey)
3: re-declare theintcolumn, now as primary key and autoincrement; it will fill automatically
4: you can do whatever you prefer up this point:
4:A: drop thepreviouskey column and rename theintcolumn to thepreviouskey ; then optimize yourtable. Fastest.
4:B: set thepreviouskey = theintcolumn; and then drop theintcolumn; but after that don't forget to re-assign primary key and autoincrement attributes to thepreviouskey column!

Reasons:
  • Long answer (-0.5):
  • No code block (0.5):
  • User mentioned (1): @variables
  • Low reputation (0.5):
Posted by: DrOne