adodb, sql server, and last insert id

S

Steve Holden

jdonnell said:
I'm not very familiar with sql server or adodb. I'm writing a python
script that uses adodb as described at http://www.ecp.cc/pyado.html,
but I can't figure out how to get the id of my last insert.
The classic method, IIRC, is as follows for SQL Server and recent
versions of Jet:

curs.execute("SELECT @@IDENTITY")
id = curs.fetchall()[0][0]

For MySQL it would be

curs.execute("SELECT LAST_INSERT_ID()")
id = curs.fetchall()[0][0]

regards
Steve
 
J

jdonnell

Thanks for the reply. I found that before I posted, but that doesn't
look thread safe and I haven't found anything that says it is or isn't.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top