470,614 Members | 1,445 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,614 developers. It's quick & easy.

insert statement question

Hi
is there any way to revice value of autoincrement column.

lets suppose that we have to tables:

1. document (id serial)
2. document_positions( id serial, document_id)

if user will insert some data to first table (docyment)
i need to use this id when adding positions of this document.

app will work in multiuser enviroment.

Regards, Robert
Aug 14 '05 #1
2 1726
RobertK wrote:
Hi
is there any way to revice value of autoincrement column.

lets suppose that we have to tables:

1. document (id serial)
2. document_positions( id serial, document_id)

if user will insert some data to first table (docyment)
i need to use this id when adding positions of this document.

app will work in multiuser enviroment.

Regards, Robert

i have solved my problem:
select currval('sequence_name') as current_value;

this will return current value for given sequence for
current user session.

Regards, RobertK
Aug 14 '05 #2
In article <dd**********@atlantis.news.tpi.pl>,
RobertK <sf****@interia.pl> wrote:
RobertK wrote:
Hi
is there any way to revice value of autoincrement column.

lets suppose that we have to tables:

1. document (id serial)
2. document_positions( id serial, document_id)

if user will insert some data to first table (docyment)
i need to use this id when adding positions of this document.

app will work in multiuser enviroment.

Regards, Robert

i have solved my problem:
select currval('sequence_name') as current_value;

this will return current value for given sequence for
current user session.

Regards, RobertK

Thanks for posting your answer! A lot of people ask, figure it out, and
then don't bother to tell the rest of us!

--
Available for Hire! http://amduus.com/Resumes/
Aug 14 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by soni29 | last post: by
16 posts views Thread by Philip Boonzaaier | last post: by
16 posts views Thread by robert | last post: by
2 posts views Thread by Geoffrey KRETZ | last post: by
1 post views Thread by glenn | last post: by
6 posts views Thread by rn5a | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.