首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 数据库 > SQL Server >

想请问一下用SQL语句在创建表中的in的用法

2012-03-23 
想请教一下用SQL语句在创建表中的in的用法?为什么下面出错create table Student(cStudentNochar(12) not n

想请教一下用SQL语句在创建表中的in的用法?
为什么下面出错
create table Student(
cStudentNo char(12) not null,
vStudentName varchar(8) not null,
iSage smallint check(iSage>=0 and iSage <=100),
nSgender nchar(2) check in('男','女'),
cClass char(10) ,
vDepartment varchar(20) default '计算机系',
primary key (cStudentNo),
)
修改后正确的
create table Student(
cStudentNo char(12) not null,
vStudentName varchar(8) not null,
iSage smallint check(iSage>=0 and iSage <=100),
nSgender nchar(2) check (nSgender='男' or nSgender='女'),
cClass char(10) ,
vDepartment varchar(20) default '计算机系',
primary key (cStudentNo),
)

希望各位高手解释一下,感激不尽!

[解决办法]

SQL code
create table Student(cStudentNo char(12) not null,vStudentName varchar(8) not null,iSage smallint check(iSage>=0 and iSage <=100),nSgender nchar(2) check (nSgender in('男','女')),cClass char(10) ,vDepartment varchar(20) default '计算机系',primary key (cStudentNo),)
[解决办法]
SQL code
create table Student(cStudentNo char(12) not null,vStudentName varchar(8) not null,iSage smallint check(iSage>=0 and iSage <=100),nSgender nchar(2) check (nSgender in('男','女')),cClass char(10) ,vDepartment varchar(20) default '计算机系',primary key (cStudentNo)) 

热点排行
Bad Request.