Thread: About auto_increment

About auto_increment

From
Yesh
Date:
Hi,

  I need to know how to increment a primary key field automatically in run
time.

--
View this message in context: http://www.nabble.com/About-auto_increment-tf2906530.html#a8120183
Sent from the PostgreSQL - general mailing list archive at Nabble.com.


Re: About auto_increment

From
Richard Huxton
Date:
Yesh wrote:
> Hi,
>
>   I need to know how to increment a primary key field automatically in run
> time.

Not sure precisely what you want to know, but read up on the SERIAL
type, sequences, nextval() and currval().

--
   Richard Huxton
   Archonet Ltd

Re: About auto_increment

From
"Raymond O'Donnell"
Date:
On 1 Jan 2007 at 21:21, Yesh wrote:

> I need to know how to increment a primary key field automatically in
> run time.

Use type SERIAL as your primary key - here is the relevant page in
the docs:

http://www.postgresql.org/docs/8.2/static/datatype-
numeric.html#DATATYPE-SERIAL

HTH,

--Ray.


----------------------------------------------------------------------

Raymond O'Donnell
Director of Music, Galway Cathedral, Galway, Ireland
rod@iol.ie
----------------------------------------------------------------------



Re: About auto_increment

From
James Neff
Date:
Yesh wrote:
> Hi,
>
>   I need to know how to increment a primary key field automatically in run
> time.
>
>
If you use the "serial" data type, the database does this for you
automatically and you don't have to worry about it.

Is this the data type your using?

--

James Neff
Technology Specialist

Tethys Health Ventures
4 North Park Drive, Suite 203
Hunt Valley, MD  21030

office:  410.771.0692 x103
cell:    443.865.7874


Re: About auto_increment

From
Ragnar
Date:
On mán, 2007-01-01 at 21:21 -0800, Yesh wrote:
>   I need to know how to increment a primary key field automatically in run
> time.

Will SERIAL do what you want?

gnari



Re: About auto_increment

From
Yesh
Date:
Hi,

 Thankx guys I am now able to increment that field by using serial.

Richard Huxton wrote:
>
> Yesh wrote:
>> Hi,
>>
>>   I need to know how to increment a primary key field automatically in
>> run
>> time.
>
> Not sure precisely what you want to know, but read up on the SERIAL
> type, sequences, nextval() and currval().
>
> --
>    Richard Huxton
>    Archonet Ltd
>
> ---------------------------(end of broadcast)---------------------------
> TIP 1: if posting/reading through Usenet, please send an appropriate
>        subscribe-nomail command to majordomo@postgresql.org so that your
>        message can get through to the mailing list cleanly
>
>

--
View this message in context: http://www.nabble.com/About-auto_increment-tf2906530.html#a8135523
Sent from the PostgreSQL - general mailing list archive at Nabble.com.