SQL Server - What is the mistake in here i tried many times but i can't find answer

Asked By Mano on 26-Jul-10 01:08 PM
 CAN WE COMPARE TWO DATES IN HERE
IF SO HOW CAN WE COMBINE TWO COLUMN THAT CONTAIN DATES AND I HAVE TO COMPARE THAT COLUMN WITH ANOTHER COLUMN
 IS THIS WRIGHT CAN SOME ONE TELL ME HOW TO DO THESE CODING
if (7/2/10 & 3/2/10) < 4/2/10  
begin
print ' ok'
end
else
begin
print 'not ok'
end
shbrat 10 replied to Mano on 26-Jul-10 02:53 PM
Hi,
Use a SELECT CASE to  achieve this:

select case

when (datediff(day,'7/2/10','4/2/10') > 0 AND datediff(day,'3/2/10','4/2/10') > 0)

then 'ok'

else 'not ok'

end