[英]Need assistance to create a simple SQL database. Error is as follows: Msg 102, Level 15, State 1, Line 2 Incorrect syntax near ','
I just need a little help with an error I am receiving when trying to create a table in SQL Server 2008 Management Studio. 在尝试在SQL Server 2008 Management Studio中创建表时遇到的错误,我只需要一点帮助。 The table I am trying to construct is: (This is only a small portion of the database which contains multiple tables similar to this one being constructed)
我要构造的表是:(这只是数据库的一小部分,其中包含与正在构造的多个表相似的多个表)
create table Holidays (
staff_ID numeric(10) foreign key,
start_Date date,
fin_Date date,
holiday_Type char(100),
reason nvarchar(100),
);
The error I am receiving is: 我收到的错误是:
Msg 102, Level 15, State 1, Line 2
Msg 102,第15级,状态1,第2行
Incorrect syntax near ','.','附近的语法不正确。
NOTE: I have created tables before in a similar fashion to this, and have looked over them to compare the differences (to which I can see is almost none). 注意:之前,我以类似于此的方式创建了表,并查看了表以比较差异(我几乎看不到差异)。
Any help is much appreciated. 任何帮助深表感谢。
You have one "," extra on the end , also your foreign key mentioned badly. 末尾有一个“,”号,也很糟糕地提到了您的外键。 Try this:
尝试这个:
create table Holidays (
staff_ID numeric(10) foreign key references Table(Column),
start_Date date, fin_Date date, holiday_Type char(100),
reason nvarchar(100))
You have an extra comma after your last column definition. 在最后一个列定义之后,您还有一个逗号。 Try this:
尝试这个:
create table Holidays (
staff_ID numeric(10) foreign key,
start_Date date,
fin_Date date,
holiday_Type char(100),
reason nvarchar(100) -- removed comma from here
);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.