SQL Convert Date including Zeros
Posted on 2004-03-22
I have this convert date code:
CONVERT(VARCHAR(15), Date, 101) As Date
ok that's good it formats the date to: 3/22/2004
In SQL Server 2000, I have some dates that have zeros like 03/22/2004 also 3/02/2004
When I run something like:
Select CONVERT(VARCHAR(15), Date, 101) As Date FROM MyTable WHERE Date BETWEEN '3/1/2004' AND '3/31/2004'
3/01/2004, 3/05/2004, 3/09/2004 etc. are not included in my query.
Only the range of:
3/10/2004 to 3/30/2004 are shown (so the 0's in the day are excluded)
Is there a way to include BOTH 03/04/2004 as well as 3/4/2004 (as an example)?