Kris Cook wrote ..
>I'm writing a form that inserts into a database table (a header
>record) with an autonumbered field (system assigned). Ordinarily, the
>value of the serial field assignment in an SQL database is stored
>in sqlca.sqlerrd[2], but I can't find any way to reference this in
>the documentation I have for Win32::ODBC. Does anyone have any ideas
>how I can get at this value? I need it as part of the foreign key
>relationship for detail records.
different databases have different ways of getting the last inserted
autonumber .. if you're using MSSQL it should be stored in the built-in
variable @@IDENTITY (that's an SQL variable - not a Perl array) .. so once
you've done your insert you should be able to immediately do a
SELECT @@IDENTITY AS 'Id'
and then grab it from the rowset of that command
--
jason king
By South Carolina state law, if a man promises to marry an unmarried
woman, the marriage must take place. - http://dumblaws.com/