Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Alter table problem??

Status
Not open for further replies.

Idee

Programmer
Jul 8, 2003
51
NZ
Hi

I need to alter a table and I am using MYSQL database. I want to add an ID column with auto increment.

ALTER TABLE tablename ADD ID INTEGER NOT NULL

In my table, there are already 80 records. What I want is that when the table is altered, the ID column should have value auto incremented from 1 to 80. With alter, I can not use Auto_Increment.

How can I achieve this?

Thanks
 
Code:
alter table <table name> add id integer not null auto_increment primary key;



[ponder]
----------------
ur feedback is a very welcome desire
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top