Received: from localhost (unknown [200.46.204.191]) by postgresql.org (Postfix) with ESMTP id A9B819FCB88 for ; Thu, 8 Nov 2007 15:10:53 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.191]) (amavisd-maia, port 10024) with ESMTP id 41526-03 for ; Thu, 8 Nov 2007 15:10:44 -0400 (AST) Received: from jupiter.marktest.pt (delta.marktest.pt [80.251.174.116]) by postgresql.org (Postfix) with ESMTP id 5BACD9FCB86 for ; Thu, 8 Nov 2007 15:10:42 -0400 (AST) Received: from suite (suite.marktest.pt [10.61.90.236]) by jupiter.marktest.pt with SMTP (Microsoft Exchange Internet Mail Service Version 5.5.2653.13) id VG9WDHHQ; Thu, 8 Nov 2007 19:10:41 -0000 Message-ID: <00c501c8223b$0dde0c90$ec5a3d0a@marktestcr.marktest.pt> From: "Oliveiros Cristina" To: "Scott Marlowe" Cc: References: <009901c82230$a799d3b0$ec5a3d0a@marktestcr.marktest.pt> Subject: Re: Obtaining the primary key of the record just inserted Date: Thu, 8 Nov 2007 19:10:41 -0000 MIME-Version: 1.0 Content-Type: text/plain; format=flowed; charset="iso-8859-1"; reply-type=original Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2900.2180 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.109 tagged_above=0 required=5 tests=AWL=0.107, BAYES_50=0.001, STOX_REPLY_TYPE=0.001 X-Spam-Level: X-Archive-Number: 200711/29 X-Sequence-Number: 29557 It worked perfectly. Thanks a million, Scott. Best, Oliveiros ----- Original Message ----- From: "Scott Marlowe" To: "Oliveiros Cristina" Cc: Sent: Thursday, November 08, 2007 6:03 PM Subject: Re: [SQL] Obtaining the primary key of the record just inserted > On Nov 8, 2007 11:56 AM, Oliveiros Cristina > wrote: >> >> Hello, All, >> >> I have the need to know the primary key assigned to a record I've just >> INSERTed . >> >> Is there an easy way to solve this ? >> >> Similar to SQLServer's SELECT scope_identity() ; ? > > In 8.2 and up: > > insert into table a (info) values ('abc') returning id; >