Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Data Bases > Pgsql Sql > Re: Get the las...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 5 of 7 Topic 3405 of 3797
Post > Topic >>

Re: Get the last inserted id

by andreas.kretschmer@[EMAIL PROTECTED] ("A. Kretschmer") Apr 11, 2008 at 07:48 PM

am  Fri, dem 11.04.2008, um 19:23:04 +0200 mailte Nacef LABIDI folgendes:
> Hi all,
>  
> I was wondering if postgres can return the last ID inserted for a table
which
> the primary key is autoincremented. I need to retrieve this ID in my
code to
> continue processing on that inserted row.

Either with RETURNING:
http://www.postgresql.org/docs/current/static/sql-insert.html

or with currval():
http://www.postgresql.org/docs/current/static/functions-sequence.html


HTH, Andreas
-- 
Andreas Kretschmer
Kontakt:  Heynitz: 035242/47150,   D1: 0160/7141639 (mehr: -> Header)
GnuPG-ID:   0x3FFF606C, privat 0x7F4584DA   http://wwwkeys.de.pgp.net

-- 
Sent via pgsql-sql mailing list (pgsql-sql@[EMAIL PROTECTED]
)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-sql
 




 7 Posts in Topic:
Get the last inserted id
nacef.l@[EMAIL PROTECTED]  2008-04-11 19:23:04 
Re: Get the last inserted id
scott.marlowe@[EMAIL PROT  2008-04-11 11:41:41 
Re: Get the last inserted id
nacef.l@[EMAIL PROTECTED]  2008-04-11 19:43:56 
Re: Get the last inserted id
Lew <lew@[EMAIL PROTEC  2008-04-27 16:09:41 
Re: Get the last inserted id
andreas.kretschmer@[EMAIL  2008-04-11 19:48:06 
Re: Get the last inserted id
ajs@[EMAIL PROTECTED] (A  2008-04-11 13:57:44 
Re: Get the last inserted id
Xharon <sahapasci@[EMA  2008-04-28 12:41:47 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Mon Dec 1 9:53:21 CST 2008.