我的mssql server数据库里的表有个字段名叫更新日期(日期格式,年月日),我要在模板的数据集里和当前时间进行比较 where 更新时间<if(当前时间<15点,(当前时间-1天)转换成年月日,(当前时间)转换成年月日) 请教一下,这个语句具体的写法.
where 更新时间 < case when DATEPART(hh,now())<15 then convert(varchar(10),DATEADD(day,-1,getdate()),120)
else
convert(varchar(10),getdate(),120)
end
where 字段 < CONVERT(varchar(10),GETDATE(),120) 试下这种呢
看一下这个,对你有帮助
http://www.cnblogs.com/shuibi/p/6564561.html