Subject | Why a certain expression in 'where' throws an error? |
---|---|
Author | kokok_kokok |
Post date | 2010-12-22T16:20:31Z |
I have simple query:
SELECT * FROM Orders
WHERE
CAST(OrderDate + CAST((LfAvgDays+0.5) AS INTEGER) AS DATE) BETWEEN '2009/1/1' AND '2010/1/1'
OrderDate is date type. LfAvgDays is float type. Why do I get error when I execute it?
I have tried also:
SELECT * FROM Orders
WHERE
CAST(OrderDate + CAST((LfAvgDays+0.5) AS INTEGER) AS DATE) BETWEEN
CAST('2009/1/1' AS DATE) AND CAST('2010/1/1' AS DATE)
Thank you
SELECT * FROM Orders
WHERE
CAST(OrderDate + CAST((LfAvgDays+0.5) AS INTEGER) AS DATE) BETWEEN '2009/1/1' AND '2010/1/1'
OrderDate is date type. LfAvgDays is float type. Why do I get error when I execute it?
I have tried also:
SELECT * FROM Orders
WHERE
CAST(OrderDate + CAST((LfAvgDays+0.5) AS INTEGER) AS DATE) BETWEEN
CAST('2009/1/1' AS DATE) AND CAST('2010/1/1' AS DATE)
Thank you