Hi,
I have a table let say it is called Table_1. PK for this table is composite; a_ID and b_ID.
When I create the following table I get an error:
There are no primary or candidate keys in the referenced table 'Table_1' that match the referencing column list in the foreign key FK_SomeTable...
CREATE TABLE SomeTable
(
a_ID INT NOT NULL,
b_ID INT NOT NULL,
c_ID INT NOT NULL,
Name VARCHAR(50)
PRIMARY KEY(a_ID, b_ID, c_ID)
FOREIGN KEY (a_ID) REFERENCES Table_1 (a_Id) ON DELETE NO ACTION ON UPDATE NO ACTION,
FOREIGN KEY (b_ID) REFERENCES Table_1 (b_ID) ON DELETE NO ACTION ON UPDATE NO ACTION,
FOREIGN KEY (c_ID) REFERENCES Table_2 (InstrumentId) ON DELETE NO ACTION ON UPDATE NO ACTION
)
How do I get around this?