Gossamer Forum
Home : General : Databases and SQL :

MySQL and auto_increment

Quote Reply
MySQL and auto_increment
If I have a table with two columns several rows of data, how do I add an auto_increment field to the table?

Everything I have tried seems to give me errors.
Taranis
http://www.spittingllamas.com

"Formal Restrictions, contrary to what you might think,
free you up by allowing you to concentrate on purer ideas."
- Winter Sorbeck in Chip Kidd's The Cheese Monkeys
Quote Reply
Re: [Taranis] MySQL and auto_increment In reply to
Use mysqlman :)

Or in your create table syntax simply add auto_increment to the column you want to be auto-increment....

eg...

Code:
CREATE TABLE test_table (
autoinc_id int(10) unsigned DEFAULT '' NOT NULL auto_increment,
something int(10) unsigned DEFAULT '' NOT NULL ,
PRIMARY KEY (autoinc_id),
);

Last edited by:

Paul: Dec 2, 2002, 1:34 PM