Inserting record with Microsoft Access
Steve Holden
steve at holdenweb.com
Thu Feb 9 07:21:06 EST 2006
Albert Leibbrandt wrote:
>
> jeffhg582003 wrote:
>
>
>>Hi,
>>
>>I am developing a python script which add records to
>>a microsoft access tables. All my tables have autogenerated number
>>fields. I am trying to capture the number generated from the insert but
>>I am not exactly sure how to do that after an insert.
>>
> I had to do something similiar in sql server and the experts back then
> told me that the only way is to write a stored procedure. aparently sql
> server does not have sequences and I am guessing that access is the same.
>
Well the experts were wrong, I suspect. Try
SELECT @@IDENTITY
to return the autonumber key created by the most recent INSERT.
I believe this works for both SQL Server and Access (doesn't anyone use
Google any more?).
regards
Steve
--
Steve Holden +44 150 684 7255 +1 800 494 3119
Holden Web LLC www.holdenweb.com
PyCon TX 2006 www.python.org/pycon/
More information about the Python-list
mailing list