[DB-SIG] autonumbers w/ODBC?

M.-A. Lemburg mal@lemburg.com
Fri, 14 Apr 2000 09:28:22 +0200

"Michal Wallace (sabren)" wrote:
> After further investigation:
>   Is it even possible to get a generated Autonumbe field via ODBC?
> Microsoft Access seems to be able to do it well enough, but how
> do you do it with mxODBC?

You don't generate autonumber fields, you declare them when
you define the table schema. ODBC let's you do this just as
all other DB API interfaces, but the syntax is of course
DB specific and not all DBs support this feature.

Its simplest to use max(id) during insert and then apply
a few tries to catch simultaneous inserts in case they
should happen. Works everywhere and doesn't need auto-increment

Marc-Andre Lemburg
Business:                                      http://www.lemburg.com/
Python Pages:                           http://www.lemburg.com/python/