[thelist] SQL : Comparing string date with a date column

oskar at hugvit.is oskar at hugvit.is
Tue Nov 28 11:06:46 CST 2000


Hi there

I am having trouble with one thing and that is comparing a string
containing a date with column values of the datetime data type.  I am using
SQL Server 2000.

This is my Select statement :
SELECT * From lvdata WHERE RDate >= '10.10.2000' AND Rdate <= '21.11.2000'

This is what I am getting:
45   10.11.2000     11:00     110
45   11.11.2000     11:00     115
45   12.11.2000     11:00     120
45   13.11.2000     11:00     110

But this is what I am supposed to get :
45   22.10.2000     11:00     100
45   23.10.2000     11:00     109
45   24.10.2000     11:00     115
45   25.10.2000     11:00     95
45   10.11.2000     11:00     110
45   11.11.2000     11:00     115
45   12.11.2000     11:00     120
45   13.11.2000     11:00     110

Seems the query treats the SQL statement as string not date.  Is there any
function I can use to fix this ?

Any help would be greatly appreciated :)

With thanks in advance,
Oskar Jensson





More information about the thelist mailing list