How can I retrieve the ID of the last record I added?

Sandeep Gupta sandeep182 at hotmail.com
Wed Jul 10 20:46:19 EDT 2002


"oblomov" <spam at oblomov.org> wrote in message
news:20020710141641.1fbadb68.spam at oblomov.org...
> On Wed, 10 Jul 2002 18:34:43 +0900
> Ian Parker <parker at gol.com> wrote:
>
> > In article <ef3269df.0207090751.40be10cf at posting.google.com>, Brian
> > <codeapocalypse at msn.com> writes
> > >Oops.  I just realized you're accessing both MySQL as well as MSSQL.
> > >My comment about @@IDENTITY applies to MSSQL.  I haven't been exposed
> > >to MySQL yet.  :)
> >
> > On MySQL there's a function LAST_INSERT_ID([expr]) to return the value
> > of the last auto-increment field on that connection.
>
> The correct way would (of course?) be to retrive the OID of the last
inserted record on the connection and then SELECT the data you are looking
for.

I hope this doesn't sound too naive....  How do I retrieve the OID of the
last inserted record?





More information about the Python-list mailing list