------=_Part_11003_13294173.1207935836808
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
Nice idea but how can I use this in a frontend that I am developing using
Delphi and ADO objects ?
On Fri, Apr 11, 2008 at 7:41 PM, Scott Marlowe <scott.marlowe@[EMAIL PROTECTED]
>
wrote:
> On Fri, Apr 11, 2008 at 11:23 AM, Nacef LABIDI <nacef.l@[EMAIL PROTECTED]
>
wrote:
> > 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.
>
> smarlowe=# create table test (a serial primary key, b text);
> NOTICE: CREATE TABLE will create implicit sequence "test_a_seq" for
> serial column "test.a"
> NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index
> "test_pkey" for table "test"
> CREATE TABLE
> smarlowe=# insert into test (a,b) values (DEFAULT,'test') returning a;
> a
> ---
> 1
> (1 row)
>
> INSERT 0 1
>
> Note that there are other ways of doing it, but I really like the
> returning clause.
>
------=_Part_11003_13294173.1207935836808
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
Nice idea but how can I use this in a frontend that I am developing using
Delphi and ADO objects ?<br><br>
<div class="gmail_quote">On Fri, Apr 11, 2008 at 7:41 PM, Scott Marlowe
<<a
href="mailto:scott.marlowe@[EMAIL PROTECTED]
">scott.marlowe@[EMAIL PROTECTED]
>>
wrote:<br>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px
0px 0.8ex; BORDER-LEFT: #ccc 1px solid">
<div>
<div></div>
<div class="Wj3C7c">On Fri, Apr 11, 2008 at 11:23 AM, Nacef LABIDI <<a
href="mailto:nacef.l@[EMAIL PROTECTED]
">nacef.l@[EMAIL PROTECTED]
>> wrote:<br>>
Hi all,<br>><br>> I was wondering if postgres can return the last ID
inserted for a table<br>
> which the primary key is autoincremented. I need to retrieve this ID
in my<br>> code to continue processing on that inserted
row.<br><br></div></div>smarlowe=# create table test (a serial primary
key, b text);<br>
NOTICE: CREATE TABLE will create implicit sequence
"test_a_seq" for<br>serial column "test.a"<br>NOTICE:
CREATE TABLE / PRIMARY KEY will create implicit
index<br>"test_pkey" for table "test"<br>
CREATE TABLE<br>smarlowe=# insert into test (a,b) values
(DEFAULT,'test') returning a;<br> a<br>---<br> 1<br>(1
row)<br><br>INSERT 0 1<br><br>Note that there are other ways of doing it,
but I really like the<br>returning clause.<br>
</blockquote></div><br>
------=_Part_11003_13294173.1207935836808--


|