Subject Re: Why Firebird AutoIncrement not trigger?
Author iysever
Another way to solve this problem is:

set the DEPARTMENTID field's AutoGenerateValue property to arAutoInc
and FieldKind property to fkInternalCalc.

I agree with my other friends but, I think this is the best way...


--- In ib-support@yahoogroups.com, "smching2001" <smching2001@y...>
wrote:
> I'm using Borland 6 & Firebird 1.0 and created a table with three
> fields:
>
> DEPARTMENTID : INTERGER NOT NULL <== P.KEY
> DEPARTMENTCODE : VACHAR(8)
> DEPARTMENTNAME : VACHAR(40)
>
> Where the column special of DEPARTMENTID is set to Create
> AutoIncrement Trigger & Generator as follow:
>
> begin
> if (new.DEPARTMENTID is null)
> then new.DEPARTMENTID = gen_id(DEPARTMENT_GEN, 1);
> end
>
> The problem is when I insert data using the DBgrid, it always
> prompted me to enter the Value of DEPARTMENTID.
> If I don't enter the value for DEPARTMENTID, error occured.
> Until I enter an unique value then I can continue. Why?
>
> Thanks