1
以下是我運行Java類時正在生成的代碼,頁面正確顯示信息但日誌文件中存在錯誤。Java,SQLSERVER語法
java.sql.SQLException:[FMWGEN] [SQLServer JDBC Driver] [SQLServer]'''附近語法不正確。
Java Code:
sql2 = " SELECT COUNT(*) CNT FROM (SELECT UPPER(SOURCECODE) as SRCCODE
FROM T1 WHERE (PRODUCTTYPE LIKE '%card%')
AND ORDER_DATE BETWEEN CONVERT(DATETIME,'"+ddet.getStartDate()+"') AND
CONVERT(DATETIME,'"+ddet.getEndDate()+"')
AND (UPPER(SOURCECODE) IS NOT NULL) GROUP BY
UPPER(SOURCECODE)) AS T";
SQL Generated:
SELECT COUNT(*) CNT FROM (
SELECT UPPER(SOURCECODE) as SRCCODE FROM T1 WHERE
(PRODUCTTYPE LIKE '%card%') AND
ORDER_DATE BETWEEN CONVERT(DATETIME,'12/01/2012') AND CONVERT(DATETIME,'10/27/2013')
AND (UPPER(SOURCECODE) IS NOT NULL)
GROUP BY UPPER(SOURCECODE)
) AS T
如果不知道查詢的目的不容易b ut我最好的猜測是你的代碼中不需要'AS T' –
什麼是T1?該表是否存在於您的數據庫中? –