0
我想創建一個視圖。視圖中的一個字段是smalldatetime字符類型。我正試圖在特定日期範圍內顯示記錄。似乎有一個字符類型轉換問題。我得到的錯誤是「將varchar數據類型轉換爲smalldatetime數據類型導致超出範圍的值。」SQL VIEWS /數據類型轉換
這裏是我的一段代碼
CREATE VIEW erep
AS
SELECT [iInvoiceID] as invoice_id
,[OrderDate] as rrdate
,[cDescription] as product
,[fQtyProcessed] as qty
,[fUnitPriceExcl] as unitpricenotax
,[fUnitPriceIncl] as unitpricewithtax
,[fUnitCost] as unitcost
,[fTaxRate] as taxrate
,[fQuantityLineTotIncl] as totalwithtax
,[fQuantityLineTotExcl] as totalnotax
,[fQuantityLineTotInclNoDisc] as totalwithtaxnodiscount
,[fQuantityLineTotExclNoDisc] as totalnotaxnodisc
,[iDeliveryStatus] as deliverystatus
FROM _bvSalesOrdersFull
where orderdate >= '2017-01-01 00:00:00' AND orderdate < '2017-31-12 00:00:00';
它可能是一個時區問題。它是否提供了orderdate列? –