0
下面的查詢給出了這樣的錯誤SQL:超出範圍值
The conversion of a nvarchar data type to a datetime data type resulted in an out-of-range value.
領域TIMEDATE看起來像在數據庫中這13/11/2012英國格式。
任何人都知道如何解決這個問題。
SELECT
PRODID, ITEMDES, QTY, StockCode,shipName, shipCompany, shipAddress1, shipAddress2, shipAddress3,shipPostCode,shipcity,shipCountry,shipCounty,customerMessage
FROM orderedItems oi
left join orders o on oi.order_id = o.order_id
where(CONVERT(nvarchar(30),timedate,120) >=
<cfqueryparam cfsqltype="cf_sql_date" value="#LSDateFormat(form.fromDate, "yyyy-mm-dd")# 00:00:00">
AND CONVERT(nvarchar(30),timedate,120) <=
<cfqueryparam cfsqltype="cf_sql_date" value="#LSDateFormat(FORM.toDate, "yyyy-mm-dd")# 23:59:59">
)
Group by PRODID,ITEMDES,QTY, StockCode,shipName, shipCompany, shipAddress1, shipAddress2, shipAddress3,shipPostCode,shipcity,shipCountry,shipCounty,customerMessage
ORDER BY PRODID
_「任何人都知道如何解決這個問題。」_存儲日期時間。 –
db建立在我之前,由於某些未知的原因,它被存儲爲varchar – Prometheus
你有'timedate'上的值,不能轉換爲'DATETIME',至少不是你所選擇的格式。最有可能像'31/02/2012'或者不同格式的線條:'05/15/2012' – Lamak