About auto_increment

Started by Yeshover 19 years ago6 messagesgeneral
Jump to latest
#1Yesh
rengesh2k3@yahoo.co.in

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.

#2Richard Huxton
dev@archonet.com
In reply to: Yesh (#1)
Re: About auto_increment

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

In reply to: Yesh (#1)
Re: About auto_increment

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
----------------------------------------------------------------------

#4James Neff
jneff@tethyshealth.com
In reply to: Yesh (#1)
Re: About auto_increment

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

#5Ragnar
gnari@hive.is
In reply to: Yesh (#1)
Re: About auto_increment

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

#6Yesh
rengesh2k3@yahoo.co.in
In reply to: Richard Huxton (#2)
Re: About auto_increment

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.