Subject | Re: [firebird-support] Trigger not firing when supposed too |
---|---|
Author | Martijn Tonies |
Post date | 2003-11-11T12:28:52Z |
Hi Uwe,
IF ( (NEW.DescrIDSQ = 0) or (NEW.DescrIDSQ IS NULL) )
in order to avoid problems with component sets that push a 0 to
the server.
If the trigger is active, it should fire just fine.
With regards,
Martijn Tonies
Database Workbench - developer tool for InterBase, Firebird & MS SQL Server.
Upscene Productions
http://www.upscene.com
> I have a problem when inserting records as my trigger that is supposed toI usually write these as:
> insert a value for the primary from a generator. The Trigger looks as
> follows. :
>
> CREATE GENERATOR GenDescription ;
> SET GENERATOR GenDescription TO 1 ;
>
> SET TERM !! ;
>
> CREATE TRIGGER TrigGenDescription FOR Description
> ACTIVE BEFORE INSERT POSITION 0
> AS
> BEGIN
> IF (NEW.DescrIDSQ IS NULL) THEN
> NEW.DescrIDSQ = GEN_ID(GenDescription,1) ;
> END !!
>
IF ( (NEW.DescrIDSQ = 0) or (NEW.DescrIDSQ IS NULL) )
in order to avoid problems with component sets that push a 0 to
the server.
If the trigger is active, it should fire just fine.
With regards,
Martijn Tonies
Database Workbench - developer tool for InterBase, Firebird & MS SQL Server.
Upscene Productions
http://www.upscene.com