select *
from dbo.March2010 A
where A.Date >= Convert(datetime, '2010-04-01' )
In this query, 2010-4-01 is treated as a mathematical expression. Therefore, in essence, it reads
select *
from dbo.March2010 A
where A.Date >= 2005;
(2010 minus 4 minus 1 is 2005, converting this to a proper datetime and adding single quotes will solve this problem.)
So the parser here might allow you to get away with
select *
from dbo.March2010 A
where A.Date >= '2010-04-01'
It will be doing the conversion for you, but in my view, it is less readable than explicitly converting to a datetime for the maintenance programmer that will come after you.
Want to be an expert in SQL programming? Join Intellipaat's SQL Certification course and learn in depth.