Sql建表格时候出错 参数或变量: 不能对数据类型 int 指定列宽

来源:百度知道 编辑:UC知道 时间:2024/05/22 17:26:55
create table PatientsInfo
(
Id int identity(1,1) primary key not null, --序号
realName varchar(10) not null, --姓名
Sex varchar(2) not null, --性别
Age int(3) not null, --年龄
Grade varchar(10) constraint ck_grade check(grade=s1 or grade=s2 or grade=s3) not null, --年级
City varchar(10) not null, --户口
Date datetime not null --入学时间
)

提示create table PatientsInfo 错误
参数或变量: 不能对数据类型 int 指定列宽前面库都建好了表不知道什么问题

Age int(3) not null,int类型不能指定长度

INT 跟MONEY一样,都是系统设定好的
不能更改

Age int(3) not null, --年龄
int类型的长度是系统默认的 4
用户是不能自己指定的

Age in t ( 3 ) no t null, -- 年龄
int 类 型 的 长度是系统默认的 4
用户是不能自己指定的
所以不能