Link to home
Start Free TrialLog in
Avatar of JoshWegener
JoshWegener

asked on

How do I create a Constraint in FireBird

I am writing a progam that converts MySQL database into a FireBird database... what is the SQL code (isql) to create a Constraint on a table?
Avatar of Nick Upson
Nick Upson
Flag of United Kingdom of Great Britain and Northern Ireland image

a trigger looks like this (artwork is the name of the table)

CREATE TRIGGER ARTWORK_I FOR ARTWORK
ACTIVE BEFORE INSERT POSITION 0
AS

begin
IF ((new.artwork_u is NULL) OR (new.artwork_u < 1)) THEN
  new.artwork_u = gen_id(gen_artwork, 1);

end

a constraint is on a field in the table

CREATE TABLE ARTWORK (
       ARTWORK_U INTEGER NOT NULL,
       DATE_SUBMITTED TIMESTAMP NOT NULL,
       DATE_RETURNED TIMESTAMP,
      CONSTRAINT ARTWORK_PK PRIMARY KEY (ARTWORK_U)
);
Avatar of JoshWegener
JoshWegener

ASKER

I need a FK Constraint
ASKER CERTIFIED SOLUTION
Avatar of Nick Upson
Nick Upson
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial