Firebird SQL Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsDatabasesFirebird SQL Development

Closed Thread
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old October 5th, 2006, 12:42 AM
DelphiPen DelphiPen is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2006
Posts: 6 DelphiPen User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 50 m 12 sec
Reputation Power: 0
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

Reply With Quote
Closed Thread

Viewing: Dev Shed ForumsDatabasesFirebird SQL Development > Trigger for autoinc ID


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway