Subject | RE: [firebird-support] Getting the last inserted row ID |
---|---|
Author | Alan McDonald |
Post date | 2004-09-30T04:20:46Z |
> At 10:52 PM 29/09/2004 -0400, you wrote:surely it falls outside the "efficient" category as well?
> >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.
>
> ./heLen
Alan