last inserted raw (identity) - Mailing list pgsql-general

From b b
Subject last inserted raw (identity)
Date
Msg-id 20030801232505.69498.qmail@web41804.mail.yahoo.com
Whole thread Raw
Responses Re: last inserted raw (identity)  (Ron Johnson <ron.l.johnson@cox.net>)
Re: last inserted raw (identity)  (Martijn van Oosterhout <kleptog@svana.org>)
List pgsql-general
 Is there an environment variable that returns the
primary key of the last inserted row. This is usefull
if you insert a rwo and need the primary key to insert
it into another table as a foreign key.

 In MS-SQL that is equivalent to @@identity variable:
 insert into organization ('org name', ....)
 insert into contact (@@identity, 'contact name'
.....)
 Here Identity is the organization's ID that is needed
as a foreign key in contact table.

 Cheers.


__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com

pgsql-general by date:

Previous
From: Jonathan Bartlett
Date:
Subject: Re: Apache - DBI - Postgresql: Cancelling queries
Next
From: Ron Johnson
Date:
Subject: Re: How to do?