Subject Re: [firebird-support] Re: Auto-increment and generators
Author Milan Babuskov
h_urlaf wrote:
> Because we have a situation where the IDs can usually be 'random' as
> long as they're unique, but in some instances we want a specific ID.

If you're setting it to some specific ID which is > gen_id(g1, 0), then
the best thing is to SET GENERATOR g1 TO that_id + 1;

> Then what is the point of things like
>
> if (new.ID is null) then new.ID = gen_id(g1, 1);

The point is that sometimes you want to copy data from other table, or
import data from some external source, and you want to be able to set
the proper values for primary key (since it may be referenced from other
table)

--
Milan Babuskov
http://fbexport.sourceforge.net