This topic is locked
[SOLVED]

  phpmyadmin question

1/14/2011 12:11:22 PM
PHPRunner General questions
V
Vienna author

In my project I am using Xampp and, of course, that means phpmyadmin. The latest Xampp uses mysql 5 by default.
Unfortunately, the sql editor wants a different kind of syntax than most "solutions" I see posted on the internet and even the online mysql reference manual does not have code that is always directly transferable to phpmyadmin.
So, after numerous failures in phpmyadmin I must ask my question here--
How, IN PHPMYADMIN, can I create a primary_id field for an already existing table of many rows of records that is AUTO NUMBERED but starts with a specific autoindex value of 2000 or whatever number I prefer...
I already have a table of 280 records that does not have a primary id column assigned yet.
I need the SQL statement into PHPMYADMIN that creates the new primary_id column for this table and at the same time Auto-Numbers the first record as 2000, the next 2001, 2002, etc, etc?
PHPMYADMIN rejects so many things as invalid code that are mentioned in the reference manual.
I have also thought of exporting the table to a new table with an auto number specified but I don't know how to specify that the auto-number starts with a certain range, such as 2000, or 3000....etc.
I would appreciate any PHPMYADMIN help on this!

Sergey Kornilov admin 1/14/2011

It's hard to believe that samples from the manual do not work. There might be something like sample field or table name that weren't replaced. Posting your query along with error message has much better chances to get a meaningful answer.
Meanwhile you can try the following:
ALTER TABLE <table> AUTO_INCREMENT = 2000;

ALTER TABLE <table> ADD COLUMN <id> INT AUTO_INCREMENT NOT NULL, ADD PRIMARY KEY(<id>);