Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 619
  • Last Modified:

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?
0
JoshWegener
Asked:
JoshWegener
  • 2
1 Solution
 
NickUpsonSenior Network EngineerCommented:
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)
);
0
 
JoshWegenerAuthor Commented:
I need a FK Constraint
0
 
NickUpsonSenior Network EngineerCommented:
ALTER TABLE EMPLOYEE ADD CONSTRAINT EMPLOYEE_FK1 FOREIGN KEY (JOBDESC) REFERENCES JOBDESC(JOBDESC_U);
0

Featured Post

Prepare for your VMware VCP6-DCV exam.

Josh Coen and Jason Langer have prepared the latest edition of VCP study guide. Both authors have been working in the IT field for more than a decade, and both hold VMware certifications. This 163-page guide covers all 10 of the exam blueprint sections.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now