您好我有一个日期字符串,我想在sql查询中粘贴。
end_date <- today()
end_date <- as.character(end_date)
trs <- sqlQuery(con, sprintf(
"select pts.PARTIJA, pts.DATA, pts.OPIS, pts.IZNOS, pts.alfa4
from pts
where OPIS = 'something' and DATA > %s", end_date))
我得到的错误是:
22018 245 [Microsoft][ODBC Driver 11 for SQL Server][SQL Server]Conversion failed when converting the varchar value '2012.01.31 ' to data type int.
知道如何正确地将日期放入查询中吗?