Click to See Complete Forum and Search --> : comparing a null datetime column


pelegk1
11-27-2005, 02:33 AM
i have a view which has some select's using inner and outer jjoins
in some of the rows i recive null on the datetime column(which is ik)
the problem is when i am trying to compare something like

select * from v_myview where lastDate >= CONVERT(DATETIME, '10/10/2005', 103))

which give me an error message of ;


The conversion of a char data type to a datetime data type resulted in an out-of-range datetime value.

any idea how can i solve this?how can i add in the wehre or what to add so the rows with the null values will be ignored?

thnaks in advance
peleg

russell_g_1
12-03-2005, 02:50 PM
you must be entering a date in the place where it says "10/10/2005" that is invalid. when you use the 103 style it needs the date in the format dd/mm/yy. so i would guess that you've muddled the day and month fields to get this error.

and if you try to convert a null to a datetime, it will just give you a null back again. so your sql could just have " and lastdate is not null" in it if you want.