每当我在localhost上的SQL标记下面尝试执行时,它会显示错误,指出msg 102,level 15,state 1,line 2'unsigned'附近的语法不正确。 [英] Whenever am trying excute below SQL tag on localhost it showing error saying that msg 102, level 15, state 1, line 2 incorrect syntax near 'unsigned'.
问题描述
CREATE TABLE userad(id int(10)unsigned NOT NULL AUTO_INCREMENT,cat_id int(10)unsigned NOT NULL,
ad_title varchar(45)NOT NULL,photo_name varchar(45)NOT NULL, description1 text NOT NULL,
price int(10)unsigned NOT NULL,contact_name varchar(45)NOT NULL,email varchar(45)NOT NULL,
m_number varchar(45 )NOT NULL,address1 varchar(45)NOT NULL,u_name varchar(45)NOT NULL,
college varchar(50)DEFAULT NULL,PRIMARY KEY(`id`,`cat_id`,`u_name` )使用BTREE,
KEY FK_userad_1(`cat_id`),FULLTEXT KEY ad_title(`ad_title`,`description`,`address`))
ENGINE = MyISAM DEFAULT CHARSET = latin1 ROW_FORMAT = DYNAMIC AUTO_INCREMENT = 31;
我尝试过:
执行上面的sql查询
错误: - 消息102,级别15,状态1,行2
'unsigned'附近的语法不正确。
CREATE TABLE userad (id int(10) unsigned NOT NULL AUTO_INCREMENT,cat_id int(10) unsigned NOT NULL,
ad_title varchar(45) NOT NULL,photo_name varchar(45)NOT NULL,description1 text NOT NULL,
price int(10) unsigned NOT NULL,contact_name varchar(45) NOT NULL,email varchar(45) NOT NULL,
m_number varchar(45) NOT NULL,address1 varchar(45) NOT NULL,u_name varchar(45) NOT NULL,
college varchar(50) DEFAULT NULL,PRIMARY KEY (`id`,`cat_id`,`u_name`) USING BTREE,
KEY FK_userad_1 (`cat_id`),FULLTEXT KEY ad_title (`ad_title`,`description`,`address`))
ENGINE=MyISAM DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC AUTO_INCREMENT=31 ;
What I have tried:
executing the above sql query
error:- Msg 102, Level 15, State 1, Line 2
Incorrect syntax near 'unsigned'.
推荐答案
SQL服务中没有unsigned int这样的东西r。
只需删除未签名部分。
另外,价格是整数吗?你确定要这么做吗?小数或金钱不是更合适吗?
There's no such thing as an unsigned int in SQL Server.
Just remove the "unsigned" part.
Also, a price as an integer? Are you sure you want to do that? Wouldn't decimal or money be more appropriate?
这篇关于每当我在localhost上的SQL标记下面尝试执行时,它会显示错误,指出msg 102,level 15,state 1,line 2'unsigned'附近的语法不正确。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!