Subject Re: [firebird-support] Getting the last inserted row ID
Author Helen Borrie
At 10:52 PM 29/09/2004 -0400, you wrote:
>In the JayBird FAQ says that in order to get the last inserted row ID
>when using a trigger to generate that ID with a generator it is
>recommended to query first to generate the ID and then insert it
>having the trigger not generate a new one when it is provided. I am
>currently using a different approach, I'd like to know your opinions
>about it.
>What I do is:
>select max(id) from table;
>Is it much more inefficient? My app is a not inserting more than 10
>rows at a time. It is an interactive application with only one user.

It is valid ONLY if that user has exclusive access to the database. It is
not a question of efficiency, it is a question of data integrity in a
system that is designed to be used concurrently by more than one user.