急请日期相减问题请教!!!!!
SQL= "select * from publicfile where datediff( 'd ',date1,now())> =byday "
其中: date1 是SQL server中的datetime 类型.
byday 是int 整型 (天数)
那么以上执行为何不行呢? 请指教,谢谢.
------解决方案--------------------SQL= "select * from publicfile where datediff( 'd ',date1,now())> = " & byday
------解决方案-------------------- datediff(day,date1,getdate())
------解决方案--------------------SQL= "select * from publicfile where datediff(d,date1,now())> = "&byday
------解决方案--------------------datediff(d,date1,now()) 把 'd '改成 d 即可.
------解决方案--------------------SQL= "select * from publicfile where datediff( 'd ',date1,getdate()) > = " & byday