Subject Re: SV: [ib-support] Porting from mysql to firebird
Author Milan Babuskov
Datatal AB - Gauffin, Jonas wrote:
> How do I retrieve the value?
> Tried to execute this query through odbc, SELECT gen_id(userid, 0), and it failed. How do I retrieve the id?
> Userid is the name of the generator.

You must select from something.

For example, many people to this:
SELECT gen_id(userid, 0) FROM RDB$DATABASE;

RDB$DATABASE is a system table that contains only one row.

You can also create a table, or stored procedure that returns one row,
and select from it.

One more thing,as Svein wrote,if you're about to insert new records do:
SELECT gen_id(userid, 1) FROM RDB$DATABASE;
to increment the value.



Milan Babuskov