读书人

求sql语句!该如何处理

发布时间: 2014-01-25 22:37:26 作者: rapoo

求sql语句!!?急啊
表中有日期字段 BeginTime
条件是找出BeginTime在1月30-2月7日之间记录,不考虑年份!!

在线等啊,谢谢各位啦
[解决办法]
试试这个:

select *
from tb
where substring(CONVERT(varchar(10),BeginTime,120),6,5) between '01-30' and '02-07'

[解决办法]
引用:
试试这个:
select *
from tb
where substring(CONVERT(varchar(10),BeginTime,120),6,5) between '01-30' and '02-07'


引用:
select *
from tb
where BeginTime between '2014-01-30 00:00:00.000' and '2014-02-07 2:59:59.997'

求解答啊亲们
[解决办法]
select *
from table
where right( CONVERT(varchar(10),getdate(),23),5) between '01-30' and '02-07'

读书人网 >SQL Server

热点推荐