×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

why does this create tabel script not work ?

why does this create tabel script not work ?

why does this create tabel script not work ?

(OP)
hello,

im trying to convert an access database to an interbase database.. therefor, i first want to create the tables in ib and then add the contents.. but im not really able to create the db.. here is my script:

CREATE TABLE Problems(

    Probleem_nr NUMERIC(10) NOT NULL,

    Machine_id VARCHAR(40) NOT NULL,

    Reported_by VARCHAR(40) NOT NULL,

    Tracker_id VARCHAR(40) NOT NULL,

    Category_id VARCHAR(40) NOT NULL,

    Openend DATE NOT NULL,

    Description VARCHAR(255) NOT NULL,

    Status VARCHAR(6) NOT NULL,

    Closed DATE,

    Actions VARCHAR(255),

    Short_Description VARCHAR(255) NOT NULL,

    PRIMARY KEY (Probleem_nr)

    );



CREATE TABLE Action_regel(

    Probleem_nr NUMERIC(10) NOT NULL,

    Action_id NUMERIC(10) NOT NULL,

    PRIMARY KEY (Probleem_nr, Action_id),

    FOREIGN KEY (Probleem_nr) REFERENCES Problems (Probleem_nr)

    );



CREATE TABLE Actions(

    Action_id NUMERIC(10) NOT NULL,

    omschrijving VARCHAR(255) NOT NULL,

    PRIMARY KEY (Action_id),

    FOREIGN KEY (Action_id) REFERENCES Action_regel (Action_id)

    );



CREATE TABLE Machine_id(

    Machine_id VARCHAR(40) NOT NULL,

    Ethernet_number VARCHAR(40),

    Location VARCHAR(40),

    PRIMARY KEY (Machine_id),

    FOREIGN KEY (Machine_id) REFERENCES Problems (Machine_id)

    );



CREATE TABLE Tracker(

    Tracker_id VARCHAR(20) NOT NULL,

    Full_name VARCHAR(50) NOT NULL,

    FUnction VARCHAR(50) NOT NULL,

    PRIMARY KEY (Tracker_id),

    FOREIGN KEY (Tracker_id) REFERENCES Problems (Tracker_id)

    );

    

CREATE TABLE Category(

    Category_id VARCHAR(40) NOT NULL,

    Description VARCHAR(255),

    upsize_ts VARCHAR(255),

    PRIMARY KEY (Category_id),

    FOREIGN KEY (Category_id) REFERENCES Problems (Category_id)

    )

here is a screenshot of the schema of the access database:
http://u0000315858.user.hosting-agency.de/access.jpg

note: in the table "problems" is "probleem_nr" the primary key !
all other bold printed words are the foreign keys..

thanks in advance

RE: why does this create tabel script not work ?

Action_regel has a composite primary key and you are trying to create an FK to it from Actions on the non-existent key Action_id. As you can't uniquely identify the associated Action row this will cause an error. Judging by your screen shot you have the FK relationships 'around the wrong way' - all the FK declarations belong in the Problems table.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close