Reputation: 1445
I have created a MYSQL table with autoincrement id, and inserted appx 10K values, so now id starts from 1 onwards.
Now I would like to change my existing ID from 10001 onwards.. i.e. my existing id 1 should starts from 10001..next 10002...
So how it possible without affect other data's
Thanks, Laxmilal Menaria
Upvotes: 0
Views: 455
Reputation: 12543
To "correct" old values do this:
UPDATE TABLE `tbl` SET `id` = `id` + 10000;
If you want all new autoincrementing values to start at 10001, do this (it will automatically skip numbers that are already set; so, if you already have 10001, it will start with 10002):
ALTER TABLE `tbl` AUTO_INCREMENT = 10000;
Upvotes: 0