开发者

Re-sequencing an Auto_Increment column

开发者 https://www.devze.com 2023-03-18 20:02 出处:网络
I have a开发者_如何学Gon Auto_Increment column starting at 1(I already have about 100 records) I want to re-sequence this column so that it will start at 1000Assuming id is the autoincrement column an

I have a开发者_如何学Gon Auto_Increment column starting at 1(I already have about 100 records) I want to re-sequence this column so that it will start at 1000


Assuming id is the autoincrement column and its smallest value is 1 this should do:

UPDATE table SET id = 999 + id

Though I am not sure this is a sensible thing to do ;)


I don't have MySQL installed to test but I guess

ALTER TABLE Table_Name AUTO_INCREMENT=1000;

should do that

0

精彩评论

暂无评论...
验证码 换一张
取 消