Subject RE: [firebird-support] Generators questions
Author Alan McDonald
>
> I've created a table (table1) with IDcod as pk
> numeric(18,0),then a generator
>

use a bigint for your PK field - not numeric(18,0)
Alan

>
>
> CREATE GENERATOR GEN_N;
>
> SET GENERATOR GEN_N TO 1;
>
>
>
> I've inserted 3 records for IDcod values 5,6,7.
>
> With IBExpert Personal,in a script I put this :
>
>
>
>
>
> SELECT gen_id(gen_N,1) FROM table1;
>
>
>
> Result :
>
> 2 3 4
>
> run again
>
> 5 6 7
>
>
>
> Why generator creates such result, for each record a value generated.
> Where is the value i look for ?
> Wouldn't it be slow for a big database ?
>
> Why generator creates values that can duplicate pk,or I have to
> use generator from the start ?
>
> Thanks.
>