August 16, 2011 at 10:25 am
Sorry if this is a repeat.
01/04/2004 is a numeric expression.
SELECT 01/04/2004-- 0
SELECT 01.0/04/2004 -- 0.00012475049
Datetime zero = "1900-01-01 00:00:00.000"
SELECT CONVERT(DATETIME,(SELECT 01/04/2004))
[1900-01-01 00:00:00.000]
This may be why the original query returned no rows, because both values were implicitly converted to 1/1/1900.
August 16, 2011 at 11:15 pm
spin (8/15/2011)
hithe reason i wanted this...
select * from Sales.SalesOrderHeader
where OrderDate between 01/01/2004 and 31/12/2004
...is because i'm trying out SSRS using BIDS. i wanted the date to be a parameter value from a textbox/date picker within the report. when i try to run the report the using @startDate/@endDate the parameter pop up window appears and i type in 01/01/2004 to whatever and it returns nothing. it now works with the xxxx-xx-xx format but no one will want to type the date in that format.
Try the following and see why that can never be...
SELECT 01/01/2004, 31/12/2004
You're not using dates... you're using quotients. 😉 Each "date" you have posted is actually a double division integer problem.
--Jeff Moden
Change is inevitable... Change for the better is not.
Viewing 2 posts - 16 through 17 (of 17 total)
You must be logged in to reply to this topic. Login to reply