Subject Re: [firebird-support] Autoincrement and IBExpert PE
Author Helen Borrie
At 05:52 PM 5/04/2004 +0200, you wrote:
>Hello,
>
>This is the before insert trigger generated:
>
>CREATE TRIGGER TBLBUILDING_BI FOR TBLBUILDING
>ACTIVE BEFORE INSERT POSITION 0
>AS
>BEGIN
> IF (NEW.TBLBUILDINGID IS NULL) THEN
> NEW.TBLBUILDINGID = GEN_ID(,1);
>END
>
>I think it lacks the field in the GEN_ID params, but I'm not
>sure!!!!

Yes, as an SQL statement, it lacks the generator name!! The generator has
to exist already:

create generator AGEN;
commit;

CREATE TRIGGER...

...THEN
NEW.TBLBUILDING ID = GEN_ID(AGEN, 1);
...

Not sure about ibexpert: perhaps it accepts the bad syntax and creates the
missing generator - I don't know about that.

>Plus, would this thing work also with the embedded version of firebird?

Sure, as long as you use correct syntax for your SQL statements. <g>
The embedded version of firebird is just regular firebird SS and the normal
client, rolled into one dll.

/hb