当前位置: 代码迷 >> ASP >> 怎么查询数据库时间字段小于当前系统时间的数据
  详细解决方案

怎么查询数据库时间字段小于当前系统时间的数据

热度:109   发布时间:2013-04-21 21:18:07.0
如何查询数据库时间字段小于当前系统时间的数据?


ccc="select * from jiagong where jieshushijian<getdate()"
如何查询数据库时间字段小于当前系统时间的数据?
请路过的前辈指点一二,谢谢。

------解决方案--------------------
ccc="select * from jiagong where datediff(ms,jieshushijian, getdate()) > 0"
------解决方案--------------------
declare @s nvarchar(50)
set @s = '2013年3月5日17小时5分9秒'
set @s = replace(replace(replace(replace(replace(replace(@s, '年', '-'), '月', '-'), '日', ' '), '小时', ':'), '分', ':'), '秒', '')
select datediff(d, @s, getdate())



sql2000 能正则么?

  相关解决方案