sql日期格式问题?#附近有语法错误
代码如下:A2 = Format(A1, "yyyy-mm-dd")
SQL = "select M1,M2,M3,M4,M5,M6,M7,M8 FROM AA02 where CONVERT(varchar(100),riq,23)=#" & A2 & "#"
rs.CursorLocation = 3
rs.Open SQL, conn, 1, 3
1、错误一:format不是可以识别的内置函数
select M1,M2,M3,M4,M5,M6,M7,M8 FROM AA02 where Format(riq,'yyyy/mm/dd')=#" & A2 & "#
百度得,access中format可以用,sql server不可以
2、错误二:#附近有语法错误
SQL = "select M1,M2,M3,M4,M5,M6,M7,M8 FROM AA02 where convert(varchar(10),riq,120)=#" & A2 & "#"
监视为:
select M1,M2,M3,M4,M5,M6,M7,M8 FROM AA02 where riq=#2014-06-01#
3、错误三:#附近有语法错误
发现,120不对,改为23
SQL = "select M1,M2,M3,M4,M5,M6,M7,M8 FROM AA02 where CONVERT(varchar(100),riq,23)=#" & A2 & "#"
抓狂,不就是CONVERT吗,前后的语句看着也没啥啊?