vBulletin Search Engine Optimization
| |||||||
| Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| Hello All, I am trying to add an autoincrement field to a table that already exists and I keep receiving errors when trying to do it. Can someone point me in the right direction on how I can do this? I have access via Webadmin and phpMyAdmin, so I can try it however I need to. Thanks, Grant Griffith Web Application Developer Enhanced Telecommunications http://www.etczone.com 812-932-1000 |
| ||||
| Grant Griffith wrote: > I am trying to add an autoincrement field to a table that already exists > and I keep receiving errors when trying to do it. Can someone point me > in the right direction on how I can do this? I have access via Webadmin > and phpMyAdmin, so I can try it however I need to. ALTER TABLE [table] ADD [fieldname] [integer type] not null auto_increment key; or if you want it to be the primary key: ALTER TABLE [table] ADD [fieldname] [integer type] not null auto_increment primary key; Keep in mind that you can have only one auto_increment column and it must be part of a key. regards Nils |
| Thread Tools | |
| Display Modes | |
|
|