foreign key en sql server
bonsoir,
j'ai crée deux tables T_VOL et t_ESCALE sous sql server2005
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14
| create table T_VOL(
sa_Num_VOL int not null,
sa_Dat_dep_VOL datetime not null,
...
primary key(sa_Num_VOL,sa_Dat_dep_VOL)
);
create table T_ESCALE(
sa_Num_VOL int constraint fk_Num_VOL1 foreign key references T_VOL(sa_Num_VOL),
sa_Dat_dep_ESC datetime constraint fk_Dat_dep_VOL1 foreign key references T_VOL(sa_Dat_dep_VOL),
...
sa_Heu_dep_ESC datetime primary key
); |
il m'affiche cet erreur
Citation:
Msg 1776, Level 16, State 0, Line 1
There are no primary or candidate keys in the referenced table 'T_VOL' that match the referencing column list in the foreign key 'fk_Num_VOL1'.
franchement j'ai pas connai la faute, surtout que le primary key de T_VOL est 2 champs; je connais seulement comment faire le Foreign key d'un seul champ
merci de votre collaboration