SQL语句 下面为什么不能建两个外键呢????
createtable(namechar(10)notnull,websiteIDintnull,cateIDintnull,newUpdateintnotnull,co...
create table
(
name char(10)not null,
websiteID int null,
cateID int null,
newUpdate int not null,
constraint fk_fenleihao
foreign key(websiteID ) references T_website(ID)
constraint fk_fenlei
foreign key(cateID) references T_Category(ID)
)
老是报错说我给newUpdate建了两个外键???怎么回事 展开
(
name char(10)not null,
websiteID int null,
cateID int null,
newUpdate int not null,
constraint fk_fenleihao
foreign key(websiteID ) references T_website(ID)
constraint fk_fenlei
foreign key(cateID) references T_Category(ID)
)
老是报错说我给newUpdate建了两个外键???怎么回事 展开
展开全部
你两个外键之间要用逗号啊。
create table
(
name char(10)not null,
websiteID int null,
cateID int null,
newUpdate int not null,
constraint fk_fenleihao
foreign key(websiteID ) references T_website(ID), --缺少逗号在这添加逗号
constraint fk_fenlei
foreign key(cateID) references T_Category(ID)
)
create table
(
name char(10)not null,
websiteID int null,
cateID int null,
newUpdate int not null,
constraint fk_fenleihao
foreign key(websiteID ) references T_website(ID), --缺少逗号在这添加逗号
constraint fk_fenlei
foreign key(cateID) references T_Category(ID)
)
展开全部
create table T_A
(
name char(10) not null,
websiteID int null,
cateID int null,
newUpdate int not null,
foreign key(websiteID) references T_website(ID),
foreign key(cateID) references T_Category(ID)
)
另外在查询分析器里运行sql语句前最好分析一下,不要直接运行
(
name char(10) not null,
websiteID int null,
cateID int null,
newUpdate int not null,
foreign key(websiteID) references T_website(ID),
foreign key(cateID) references T_Category(ID)
)
另外在查询分析器里运行sql语句前最好分析一下,不要直接运行
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
第一行没有给出表的名字;第8行最后少了一个逗号
create table ttt
(
name char(10)not null,
websiteID int null,
cateID int null,
newUpdate int not null,
constraint fk_fenleihao
foreign key(websiteID ) references T_website(ID),
constraint fk_fenlei
foreign key(cateID) references T_Category(ID)
)
create table ttt
(
name char(10)not null,
websiteID int null,
cateID int null,
newUpdate int not null,
constraint fk_fenleihao
foreign key(websiteID ) references T_website(ID),
constraint fk_fenlei
foreign key(cateID) references T_Category(ID)
)
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询