日期:2014-05-17 浏览次数:20921 次
比如:
with t as
(
select 1 as id,'2013-02-27' as [date],'08:00:00.157' as [time] union
select 2,'2013-02-27','09:00:00.157' union
select 3,'2013-02-27','10:00:00.157'
)
select * from t where CONVERT(VARCHAR(10),[date],121)+' '+CONVERT(VARCHAR(8),[time],108)>='2013-02-27 08:00:00' and CONVERT(VARCHAR(10),[date],121)+' '+CONVERT(VARCHAR(8),[time],108)<='2013-02-27 09:30:00'
id date time
----------- ---------- ------------
1 2013-02-27 08:00:00.157
2 2013-02-27 09:00:00.157
(2 行受影响)