Subject Re: [ib-support] Displaying auto-number value
Author Martijn Tonies
Hi Arno,

> I am a newby to Firebird.
>
> I would like to display the (generatied) value of an auto-number
> field (I've got auto-numbering working just fine).
>
> In MySQL there is a 'LAST_INSERT_ID()' function for this.
>
> How can I achieve this in Firebird/IB?

With a single-user system, you can query the GEN_ID(mygen, 0) -
but this isn't multiuser safe.

For a multi-user system, you'd better get the value first and use that
for your insert. That way, you have the value at the client side and
you can do anything you want with it (also useful for inserting stuff
into multiple tables with a referential constraint)

Martijn Tonies
InterBase Workbench - the developer tool for InterBase and Firebird
http://www.interbaseworkbench.com

Upscene Productions
http://www.upscene.com

"This is an object-oriented system.
If we change anything, the users object."