dark desire
2010-08-18 10:33:24 UTC
(mfr_id int not null,
product_id int not null,
description varchar(20),
price money,
qty_on_hand integer,
constraint product2_pk primary key(mfr_id,product_id))
create table orders2
(order_num int not null,
order_date datetime not null,
cust int,
rep int,
mfr int,
product int not null,
qty int,
amount money,
constraint orders2_pk primary key(order_num))
alter table orders2
add constraint orders2_fk5
foreign key(product)
references product2(mfr_id,product_id)
error:Number of referencing columns in foreign key differs from number of referenced columns, table 'orders2'.
if i use only product_id as reference then i get error:
There are no primary or candidate keys in the referenced table 'product2' that match the referencing column list in the foreign key 'orders2_fk5'.