On 07 Jun 2001 14:58:17 -0500, Williams, Travis L, NPONS wrote:
> All,
> I'm not sure if I'm on the right track here.. I want to create a
> column that is automatically filled in with a unique number when a row is
> created.. I thought that creating a sequence would do this.. and then
> creating a column with a default of nextval('seqname') but it isn't doing
> anything.. any help is appreciated...
>
CREATE TEMP TABLE tempo (a text, id serial PRIMARY KEY);
INSERT INTO tempo VALUES ('foo');
INSERT INTO tempo VALUES ('bar');
SELECT * from tempo;
foo 1
bar 2
You can leave out the PRIMARY KEY, or insted use UNIQUE, or whatever ...
cu
--
Nabil Sayegh