Subject Re: [firebird-support] To know the last inserted or deleted
Author Jerome Bouvattier
Hi,

> ----- Original Message -----
> From: akestion
> To: firebird-support@yahoogroups.com
> Sent: Wednesday, March 03, 2004 4:18 PM
> Subject: [firebird-support] To know the last inserted or deleted
>
> Hi again,
>
> Is it possible to find the last values inserted or deleted as in MS.
> SQLsever, thanks a tables INSERTED or DELETED.

You refer to the @IDENTITY feature right ?

Then, in FB it's done the other way around. You retrieve the generated ID
from the appropriate generator *before* actually inserting records.

Select gen_id(<your generator name>, 1) from rdb$database

Then use the return ID in your insert.

Note : The system table rdb$database is used here because it is guaranteed
to hold one and only one record but any other table with the same
characteristic will do.

Regards.

--
Jerome