in reply to DBI and primary keys
For Sybase ASE and mssql the following sql-statement should give you the correct value:
select @@identity [download]