【发布时间】:2011-07-23 12:03:31
【问题描述】:
为什么必须在一个表的列上具有主键,而另一个表的列具有外键引用。
create table D(Did int)
create table E(Eid int foreign key references D(Did))
以上查询报错:
There are no primary or candidate keys in the referenced table 'D' that match
the referencing column list in the foreign key 'FK__E__Eid__79C80F94'.
【问题讨论】:
标签: sql sql-server-2005 foreign-keys primary-key key