CREATE PROC sp_planlist
AS
DECLARE @SQL2 VARCHAR(5000)
set @sql2=@sql2+' and a.plan_begintime<=convert(varchar(10),getdate(),120) and a.plan_endtime >= convert(varchar(10),getdate(),120)'
...
搜索今日的信息
如果 开始时间为2008-6-27 00:00,结果时间为:2008-6-28 15:30 可以搜索到
但如果开始时间为2008-6-27 14:00,结果时间为:2008-6-28 15:30 就搜索不到.不知为什么
AS
DECLARE @SQL2 VARCHAR(5000)
set @sql2=@sql2+' and a.plan_begintime<=convert(varchar(10),getdate(),120) and a.plan_endtime >= convert(varchar(10),getdate(),120)'
...
搜索今日的信息
如果 开始时间为2008-6-27 00:00,结果时间为:2008-6-28 15:30 可以搜索到
但如果开始时间为2008-6-27 14:00,结果时间为:2008-6-28 15:30 就搜索不到.不知为什么
解决方案 »
- 用visual studio类型化数据集设计器,有什么好书么
- sql中<>什么意思?它的用法
- SQL语句: where tname='aa' or tname='bb' 和 where tname in ('aa','bb') 哪个效率高?
- 日期格式比较问题,小弟很着急
- 标题是:简单SQL语句出错!!!!急!!!
- 请教 :bcp 导出是ascii文本文件 的格式问题
- sql server可以装在2000的专业版上么。
- 再问数据库;cannot detach the database 'database0' because it is currently in use 是什末原因呢?
- 刚写的格式化文本段落的,请各位更改
- 对等网,不知怎样学sql server.
- MSsql MAX 与 between 提问
- 当一个触发器代码很长时,那么另一个事件导致触发了,会是怎么样呢?
and datediff(dd,a.plan_endtime,getdate())=0
或
convert(varchar(10),a.plan_begintime,120)=convert(varchar(10),getdate,120) and
convert(varchar(10),a.plan_endtime,120)=convert(varchar(10),getdate,120)
a.plan_endtime >= convert(varchar(10),getdate(),120)
只要判断 结束日期就可以了,这样肯定是有包含今天的信息
刚才开始时间是=2008-6-27 00:00而后面2008-6-27 14:00,就不满足了,所在就查不到数据了