注册 登录
编程论坛 SQL Server论坛

菜鸟求助 求写时间的约束

luijay 发布于 2008-08-16 10:58, 757 次点击
在企业管理器中 我约束时间只能在1999-1-1到2008-8-8中输入

在顺便帮我写写在查询分析器中写的代码

谢谢了
1 回复
#2
qazzwj2008-08-16 16:03
create table #SrList(SrNo char(20),dt datetime )

alter table #SrList add constraint chk_dt check(dt>='1999-1-1' and dt<='2008-8-8')

insert into #SrList values('qq','2007-7-7')
insert into #SrList values('qq','2009-7-7')

select * from #SrList

drop table #SrList
1