34,588
社区成员
发帖
与我相关
我的任务
分享
Create table Student(
sno char(6) NOT NULL,
sname char(20) NOT NULL,
sex char(2),--我想让它只能是'男'或'女'怎么办呢?
age numeric(2),
dept char(30) NOT NULL
)
Create table Student(
sno char(6) NOT NULL,
sname char(20) NOT NULL,
sex char(2) CONSTRAINT CK_sex CHECK ([sex]=N'女' OR [sex]=N'男'),
age numeric(2),
dept char(30) NOT NULL
)
create Rule Rule_sex
as
@sex in('男','女')
go
exec sp_bindrule 'Rule_sex','Student.sex'
Create table Student(
sno char(6) NOT NULL,
sname char(20) NOT NULL,
sex char(2) CHECK (sex IN('男','女')),--我想让它只能是'男'或'女'怎么办呢?
age numeric(2),
dept char(30) NOT NULL
)