I have a composite foreign key that has to be part of the primary key of the new table... but an error appears in SQL server...
CREATE TABLE Se_paga_con
(IDpel INT NOT NULL,
IDvta INT NOT NULL,
IDnota INT NOT NULL,
PRIMARY KEY (IDpel,IDvta,IDnota),
FOREIGN KEY (IDpel, IDvta) REFERENCES PeliculaEnVenta(IDpel, IDvta));
IDpel AND IDvta ARE the primary key from PeliculaEnVenta
There are no primary or candidate keys in the referenced table 'PeliculaEnVenta' that match the referencing column list in the foreign key 'FK__Se_paga_con__51851410'.
SQL server 2008
November 17, 2009 1:56 AM
November 17, 2009 3:01 PM