Autonumbering column

Started by Ryan Mchaleover 27 years ago3 messagesgeneral
Jump to latest
#1Ryan Mchale
sdecoop2@nortel.ca

Hi,

Is there anyway to have an autonumbering field?

Ryan

#2James Olin Oden
joden@lee.k12.nc.us
In reply to: Ryan Mchale (#1)
Re: [GENERAL] Autonumbering column

Hi,

Is there anyway to have an autonumbering field?

I don't think so, but there is a way to generate the values for a key
column safely. Look at the manpage on create_sequence...james

#3Antonio Garcia Mari
agarcia@at4.net
In reply to: James Olin Oden (#2)
Re: [GENERAL] Autonumbering column

this is a hack, but it works...

CREATE SEQUENCE key_s INCREMENT 1 START 1;
CREATE TABLE cliente (
key int4 NOT NULL DEFAULT nextval('key_s') PRIMARY KEY,
name varchar(100) UNIQUE NOT NULL,
username varchar(8) NOT NULL
);

Hi,

Is there anyway to have an autonumbering field?

I don't think so, but there is a way to generate the values for a key
column safely. Look at the manpage on create_sequence...james

Antonio Garcia Mari
Mallorca (Spain)