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

Ian Parker parker at gol.com
Wed Jul 10 05:34:43 EDT 2002


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.

Regards

-- 
Ian Parker



More information about the Python-list mailing list