0

I have table row idenntifyID type varchar, I want set values ID 01, ID 02, ID 03 it's possible with only SQL ? now is ID 200, ID 654 etc, I want change that will be from 1 to n

user2287965
  • 203
  • 2
  • 6
  • 14
  • Usually changing Ids makes not a lot of sense beside looking "nice" which is a bad reason. Might I ask why do you want to do this? – Chief Wiggum May 22 '13 at 22:11
  • Because I create table from scrath and it's not id it's identify key of something I cant it change – user2287965 May 22 '13 at 22:12
  • Did you have a look at this: http://stackoverflow.com/questions/740358/mysql-reorder-reset-auto-increment-primary-key – Chief Wiggum May 22 '13 at 22:20
  • Is this an auto-increment key? Is the content of the field ID 01 or just 1 ? If it is an auto-increment key you can't. The only ways are to create a new table with the auto increment key starting at 1 and copy all the data - leaving out the key - from the old table to the new one, or drop the primary key column and create it again. More info on auto increment keys: http://dev.mysql.com/doc/refman/5.0/en/example-auto-increment.html – mspir May 22 '13 at 22:21
  • Check [here](http://stackoverflow.com/q/16691885/1297603) also on comments about why reseeding ID's is not usually recommended – Yaroslav May 22 '13 at 22:23

1 Answers1

0

check out the links

How to Auto Increment ID Numbers with Letters and Numbers

and

MySQL auto increment plus alphanumerics in one column

OR

If you need to display "ID" with numbers for user viewing purpose just use your application to add it to your auto-increment field when displaying data.

Community
  • 1
  • 1
user2345661
  • 425
  • 3
  • 8
  • 14