Subject | Re: [firebird-support] GEN_ID Trigger |
---|---|
Author | Martijn Tonies |
Post date | 2003-10-09T08:17:49Z |
Hi Dion,
With regards,
Martijn Tonies
Database Workbench - developer tool for InterBase, Firebird & MS SQL Server.
Upscene Productions
http://www.upscene.com
> I am using ADO components to connect to a Firebird database. I havecreated
> a trigger to genrerate a unique id for a table. When appending a recordto
> the table using IBOConsole, the new id value is not inserted into theNo it's not normal - you might want to change your trigger code to:
> relevant field, ie the trigger is not 'triggered'. It is active. Is this
> normal?
> CREATE TRIGGER "NEW_CONTACTS_ID" FOR "CONTACTS" ACTIVEIF ( (NEW.OBJID IS NULL) OR (NEW.OBJID = 0) ) THEN
> ACTIVE BEFORE INSERT POSITION 0
> AS
> BEGIN
> IF (NEW.OBJID IS NULL) THEN
> NEW.OBJID = GEN_ID(GEN_CONTACT_ID, 1);As you're not telling what get's inserted, if at all.
> END
With regards,
Martijn Tonies
Database Workbench - developer tool for InterBase, Firebird & MS SQL Server.
Upscene Productions
http://www.upscene.com