Subject Re: [IBO] insertSQL Help please
Author newgen3152003
Thanks again Helen,

please excuse my lack of knowledge here, but is this how it should be
written?
SET TERM ^;
CREATE TRIGGER FOR LOCATIONS BEFORE INSERT POSITION 0
AS BEGIN
IF(NEW.IDLOC IS NULL) THEN NEW.IDLOC = GEN_ID
(GEN_LOCATIONS_IDLOC,1);
END ^
SET TERM ;^

no need for a trigger name? what does position 0 mean?
Daniel
ps the ronan example was just what I needd




--- In IBObjects@yahoogroups.com, Helen Borrie <helebor@t...> wrote:
> At 11:48 PM 8/03/2004 +0000, you wrote:
> >Thanks Helen,
> >
> >but when I use New.IDLOC is NOT NULL
> >I get an error;
> >Validation Error for Column IDLOC, value ****null*****
> >
> >is there something else to set? I have generatorlinks
> >IDLOC=GEN_LOCATIONS_IDLOC
> >
> >Daniel
>
> Errrrk!!! sorry, typo in my example.
>
> create trigger for yourtable active before insert position 0
> as
> begin
> if (new.idloc is null) then
> new.idloc = gen_id(gen_locations_idloc, 1);
> end
>
> Sorry for that.
>
> Helen
>
> >
> > > Your trigger needs to be
> > > if (new.ID is not null) then <==========================
> > > new.ID = gen_ID (your_generator, 1);
> > >