473,224 Members | 1,597 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,224 software developers and data experts.

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 1776
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Sans Spam | last post by:
Greetings! I have a table that contains all of the function permissions within a given application. These functions are different sections of a site and each has its own permissions (READ, WRITE,...
4
by: soni29 | last post by:
hi, i have a small question regarding sql, there are two tables that i need to work with on this, one has fields like: Table1: (id, name, street, city, zip, phone, fax, etc...) about 20 more...
1
by: shottarum | last post by:
I currently have 2 tables as follows: CREATE TABLE . ( mhan8 int, mhac02 varchar(5), mhmot varchar(5), mhupmj int )
16
by: Philip Boonzaaier | last post by:
I want to be able to generate SQL statements that will go through a list of data, effectively row by row, enquire on the database if this exists in the selected table- If it exists, then the colums...
16
by: robert | last post by:
been ruminating on the question (mostly in a 390/v7 context) of whether, and if so when, a row update becomes an insert/delete. i assume that there is a threshold on the number of columns of the...
2
by: Geoffrey KRETZ | last post by:
Hello, I'm wondering if the following behaviour is the correct one for PostGreSQL (7.4 on UNIX). I've a table temp_tab with 5 fields (f1,f2,f3,...),and I'm a launching the following request :...
1
by: glenn | last post by:
Hi folks, I am using an Access database, VB.NET and ADO.NET working with a DataGrid control. MY datagrid table has both a date_sent and a date_ans field. When I Insert a record in my SQL...
3
by: rhaazy | last post by:
Using ms sql 2000 I have 2 tables. I have a table which has information regarding a computer scan. Each record in this table has a column called MAC which is the unique ID for each Scan. The...
6
by: rn5a | last post by:
During registration, users are supposed to enter the following details: First Name, Last Name, EMail, UserName, Password, Confirm Password, Address, City, State, Country, Zip & Phone Number. I am...
1
by: javedna | last post by:
Can PHP help with the following as I have tried in the MYSQL Forums and cant get any help Thanks Nabz ---------------------------------------- Hi I am developing a PHP MYSQL questionnaire...
1
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
0
by: veera ravala | last post by:
ServiceNow is a powerful cloud-based platform that offers a wide range of services to help organizations manage their workflows, operations, and IT services more efficiently. At its core, ServiceNow...
0
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
2
by: jimatqsi | last post by:
The boss wants the word "CONFIDENTIAL" overlaying certain reports. He wants it large, slanted across the page, on every page, very light gray, outlined letters, not block letters. I thought Word Art...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.