我试着从零点到现在所有的记录
例如21.02.2014 00:01到21.02.2014 10:41(现在时间)
Select * from TableName Where Time >=??? and Time < Getdate()发布于 2014-02-21 16:44:08
Select * from TableName Where Time between ??? and Getdate()发布于 2014-02-21 16:46:57
Select * from TableName Where DateDiff(day,TimeColumn,getdate())
between 0 and 0发布于 2014-02-21 21:58:25
如果您使用的是SQL2008或更高版本,则可以执行类似ff的操作:
select *
from tablename
where cast([Time] as date) = getdate()
and cast([Time] as time) >= '10:41'这不会有很好的性能,因为cast使谓词不能SARGable。如果这是您想要经常做的事情,您可以将持久化计算列添加到为您执行强制转换的表中。
https://stackoverflow.com/questions/21929355
复制相似问题