Re: How to do auto numbering on INT column

From: Brent Wood <b(dot)wood(at)niwa(dot)co(dot)nz>
To: Junkone <junkone1(at)gmail(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: How to do auto numbering on INT column
Date: 2006-08-10 20:38:42
Message-ID: 44DB9952.5030306@niwa.co.nz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Junkone wrote:
> HI
> I have a simple table created using PGAdmin III. How do i do a auto
> numbering on a column SYMBOL_ID?
> My table is
> CREATE TABLE "SYMBOL"
> (
> "SYMBOL_ID" int4 NOT NULL,
> "SYMBOL2EXCHANGE" int2 NOT NULL,
> "SYMBOL_ALIAS" text[],
> "RELATED_SYMBOLS_OTHER_EXCHANGES" int8[],
> "SYMBOL_NAME" text,
> "COMPANY_NAME" text,
> "SYMBOL2SECTOR" int2,
> "SYMBOL2INDUSTRY" int4,
> "STOCK_SUMMARY" text
> )
>
If you can, the easy way is to recreate the table using a serial
datatype instead of int4.

See the docs at
http://www.postgresql.org/docs/8.1/interactive/datatype.html#DATATYPE-SERIAL

Otherwise this also shows the long way to do it.

HTH,

Brent Wood

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Jasbinder Bali 2006-08-10 21:27:55 Re: Unable to connect to PostgreSQL 8 from PGAdmin III
Previous Message marcelo Cortez 2006-08-10 19:21:40 my first procedure