Re: [GENERAL] simple auto increment question.

From: Sferacarta Software <sferac(at)bo(dot)nettuno(dot)it>
To: pgsql-general(at)postgreSQL(dot)org, Jeremy Hansen <jeremy(at)xxedgexx(dot)com>
Subject: Re: [GENERAL] simple auto increment question.
Date: 1998-08-20 12:26:24
Message-ID: 7601.980820@bo.nettuno.it
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hello Jeremy,

giovedì, 20 agosto 98, you wrote:

JH> I want to create a simple auto increment field
JH> starting at 0000 for example.
^^^^ I supose you mean 1

JH> How do I do this in postgres?

JH> Thanks
JH> -jeremy

Examples:

-- How to create a sequence starting with 1:
--
CREATE SEQUENCE serial START 1;

-- How to assign the sequence as default to column <did>:

CREATE TABLE distributors (
did INTEGER DEFAULT NEXTVAL('serial'),
name VARCHAR(40)
);

Best regards,
Jose' mailto:sferac(at)bo(dot)nettuno(dot)it

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Rostislav Matl 1998-08-20 14:00:08 column name length
Previous Message Sferacarta Software 1998-08-20 11:08:34 DELETE statement KILL backend