Subject | two foreign key to one primary key |
---|---|
Author | sebastianmartin98 |
Post date | 2004-03-05T20:35:47Z |
Hi,
I'm newie with Firebird, I need help with this, the problem is
that I need to make reference in two columns to the same primary key
of another table, so..., when I try to do this:
CREATE TABLE MOVSTOCK (CODMOV NUMERIC(18)
NOT NULL
PRIMARY KEY,
DEPORIGEN NUMERIC(18)
DEFAULT NULL,
DEPDESTINO NUMERIC(18)
DEFAULT NULL,
...
CANTIDAD NUMERIC(18)
NOT NULL
CHECK (CANTIDAD > 0),
FOREIGN KEY (DEPORIGEN) REFERENCES DEPOSITOS
(CODDEPOSITO),
FOREIGN KEY (DEPDESTINO) REFERENCES DESPOSITOS
(CODDEPOSITO));
I always receive an error like this:
Statement failed, SQLCODE = -607
unsuccessful metadata update
-could not find UNIQUE INDEX with specified columns
Statement failed, SQLCODE = -104
If I only use one reference to the foreing key, it works fine.
My FB Version is 1.5.0.4288
any help?? why is that? is my error?
Thanks;
Sebastian.
I'm newie with Firebird, I need help with this, the problem is
that I need to make reference in two columns to the same primary key
of another table, so..., when I try to do this:
CREATE TABLE MOVSTOCK (CODMOV NUMERIC(18)
NOT NULL
PRIMARY KEY,
DEPORIGEN NUMERIC(18)
DEFAULT NULL,
DEPDESTINO NUMERIC(18)
DEFAULT NULL,
...
CANTIDAD NUMERIC(18)
NOT NULL
CHECK (CANTIDAD > 0),
FOREIGN KEY (DEPORIGEN) REFERENCES DEPOSITOS
(CODDEPOSITO),
FOREIGN KEY (DEPDESTINO) REFERENCES DESPOSITOS
(CODDEPOSITO));
I always receive an error like this:
Statement failed, SQLCODE = -607
unsuccessful metadata update
-could not find UNIQUE INDEX with specified columns
Statement failed, SQLCODE = -104
If I only use one reference to the foreing key, it works fine.
My FB Version is 1.5.0.4288
any help?? why is that? is my error?
Thanks;
Sebastian.