Nizam Nizam

Nizam Nizam

  • NA
  • 32
  • 21.2k

sql DB Query changing PK value

May 9 2015 7:06 AM
my DB i want to change all the tables primary key a specific number incriment "9" how can do it with one query

Answers (2)

0
Nanhe Siddique

Nanhe Siddique

  • 0
  • 2.5k
  • 367.1k
May 9 2015 8:12 AM
 i think you want to change default increment  value of primary key.
if i am write.

write following wuery
  
ALTER TABLE `users` AUTO_INCREMENT = 9
this command change auto increment from 1 to 9 
  





 i hope it will help you

 
0
Anupam Singh

Anupam Singh

  • 349
  • 4.9k
  • 1.7m
May 9 2015 7:15 AM
You have to remove primary key constraint from column and update values, after updating values you can make the same column primary key.

I am not 100% sure but try with sample table first.