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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Autonumber in SQL

Status
Not open for further replies.

mattster

Programmer
Apr 26, 2007
15
US
Hi, I want to make a certain column do something like autonumber (from MS Access)... I know i have to set the column to be the primary key, and set it to AUTO_INCREMENT, but I don't know how to do that.. can anyone help me out? Thanks in advance!
 
I'm using MySQL... whatever the default is :T
 
Doh, haven't used MySQL enough to be much help there.
I know in Access to do it using SQL would be something like

create table abc (field1 COUNTER, etc etc) codestorm
 
Hello,
See the example:

CREATE TABLE client (
client_id int(8) DEFAULT '0' NOT NULL auto_increment,
city varchar(60),
state varchar(80),
country char(2),
postal_code varchar(13),
username varchar(32),
contact_email varchar(127),
PRIMARY KEY (client_id)
);

The format is given in the MySQL Manual

Hope this helps.
D.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top