|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Triggers for autoinc ID in Firebird
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 |
|
#2
|
||||
|
||||
|
Note that there is a specific Firebird forum, please move your question there
__________________
My blog about OpenSource Databases PDF tutorials about OSS databases, DBMonster ... Please contribute to Open Source Development, fill bug reports!!! Developer Shed eSupport Commented my.ini/my.cnf (PLEASE ADD YOUR OWN CONFIG TRICK) An introduction to database normalization Natural or Surrogate key Custom ordering for your results Correlated and uncorrelated subqueries Don't turn your outer joins into inner joins |
|
#3
|
|||
|
|||
|
Quote:
Soory, I didn't know. I'll look for the Firebird forum. Maybee you can tell me a quick way to move my question there ???? Thanks Pia |
|
#4
|
|||
|
|||
|
It's a bug in Database Workbench. It sounds pretty stupid actually -- it's the name of your trigger that confuses it. Check constraints automatically create triggers, but these triggers will show up as a check constraint in Database Workbench. These will be named CHECK_ something and that is why GUI tools filter on them.
I've created a bugreport here: http://tracker.upscene.com/view.php?id=686 Thanks. -- Martijn Tonies Upscene Productions www.upscene.com |
![]() |
| Viewing: Dev Shed Forums > Databases > Firebird SQL Development > Triggers for autoinc ID in Firebird |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|