0

次のクエリでは、このエラーが発生します

The conversion of a nvarchar data type to a datetime data type resulted in an out-of-range value. 

フィールド timedate は、データベースでこの 13/11/2012 uk 形式のようになります。

誰でもこの問題を解決する方法を知っています。

        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 
4

1 に答える 1

1

私は sql-server があなたの日付をあたかもアメリカの形式であるかのように解釈している可能性があると思いmm/dd/YYYYます.

おそらく、適切なフィールド タイプを使用して日付を保存する方が適しているでしょう。

于 2012-08-31T15:28:30.837 に答える