【发布时间】:2011-03-11 20:37:04
【问题描述】:
这个问题与this one 非常相似,但针对的是 SQL Server 2005:
我的数据库中有 2 个表:
--'#' denotes the primary key
[Libraries]
#ID #Application Name
1 MyApp Title 1
2 MyApp Title 2
[Content]
#ID Application LibraryID Content
10 MyApp 1 xxx
11 MyApp 1 yyy
(数据库显然要复杂得多,拥有这个双键是有意义的)
每个库都由其唯一的 ID 和应用程序名称标识。我正在努力确保每个内容都正确引用了现有库。
当创建约束(使用向导)时
Primary key table Foreign key table
[Libraries] [Content]
ID ---> LibraryID
Application ---> Application
我有以下错误:
表“库”中的列 与现有主键不匹配或 唯一约束
你知道发生了什么吗?以及是否有可能使用 SQL Server? (我根本无法修改 [Library] 表)
非常感谢您的帮助!
【问题讨论】:
标签: sql sql-server-2005 foreign-key-relationship