|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Trigger for autoinc ID
Hi all,
Excuse my English... I'm working with Database Workbench (= DBW) on my Firebird for 9 month with great pleasure. But now when I'm going to put the autoinc IDs on my tables I get problems. I can put a trigger on my table and view it nicely in DBW as trigger on the table, but next time I refresh/connect the trigger has gone and the depending object on the generator is marked as a check symbol and if I try to create the trigger again I'm told it's existing. I've already made this kind of trigger successfully on 12 tables with no problems. create table CHECKELPOLSTAFF ( ID Integer NOT NULL, StaffID Integer, Dato Date, Tid Time, WhereWas varchar(20), BreakTime Time, CONSTRAINT PK_CHECKELPOLSTAFF PRIMARY KEY (ID) ); CREATE INDEX inxStaffID_CHECKELPOLSTAFF ON CHECKELPOLSTAFF (StaffID, Dato, Tid, WhereWas); CREATE GENERATOR CHECKELPOLSTAFF_GEN; SET TERM ^^ ; CREATE TRIGGER CHECKELPOLSTAFF_ID FOR CHECKELPOLSTAFF ACTIVE BEFORE INSERT POSITION 0 AS begin if ( (new.ID is null) or (new.ID = 0) ) then new.ID = gen_id(CHECKELPOLSTAFF_GEN, 1); end ^^ SET TERM ; ^^ Thanks Pia Last edited by DelphiPen : October 5th, 2006 at 12:53 AM. Reason: Closing the thread |
| Viewing: Dev Shed Forums > Databases > Firebird SQL Development > Trigger for autoinc ID |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|