increment the primary key value without using sequences

From: roopa perumalraja <roopabenzer(at)yahoo(dot)com>
To: pgsql-sql(at)postgresql(dot)org
Subject: increment the primary key value without using sequences
Date: 2007-07-29 12:00:09
Message-ID: 945413.94674.qm@web50803.mail.re2.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Hi all,

I would like to know if its possible to increment the primary key field value of stocks table without using sequences by getting the next value of the pk field from the sequnce table ?

insert into stocks (prim_id, date,time, code, price, volume) (select ..... from temp_stocks)

sequence
sequence_code | next_value
prim_id 101

stocks table (prim_id, date, time, code, price, volume)

temp_stocks table (date, time, code, price, volume)

If it can be done, can you please explain me with an example.

Thanks a lot in advance.


---------------------------------
Sick sense of humor? Visit Yahoo! TV's Comedy with an Edge to see what's on, when.

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Michael Glaesemann 2007-07-29 13:37:41 Re: increment the primary key value without using sequences
Previous Message Michal Kedziora 2007-07-29 11:33:25 Re: raise exception and transaction handling