Subject Re: Synchonizing my generators
Author Svein Erling
Hi Lee!

Of course, the best thing is to follow Helens advice, though it is
possible to increase the generator as you want to in a couple of
steps:

Max_Value = SELECT MAX(My_PrimaryKey) FROM MyTable
IncBy = Max(0, MaxValue - GEN_ID(MyGenerator, 0))
SELECT GEN_ID(MyGenerator, IncBy) from rdb$database

Since this only increases and never decreases the generator it is
safe, but if you have to do something like this, it does indicate that
things are not ideal.

Set

--- In firebird-support@yahoogroups.com, "Lee Jenkins" wrote:
>
> Hello all,
>
> Sometimes we need to import data into our database and many times
> the key primary key field is supplied during the import. Is there a
> way for me to check each generator against the table that uses it,
> see what the highest value of the pk field is and increment the
> generator used for that field by one more?