select 1 from sysfiles where '2009-06-01' = '2009-6-1' 这肯定是不成立的。 因为是两个字符串。 但是作为日期他们是等的。也就是select 1 from sysfiles where cast('2009-06-01' as smalldatetime) = cast('2009-6-1' as smalldatetime)这是OK
select 1 from sysfiles where '2009-06-01' = '2009-6-1' 显然不正确,因为是字符串比较 select 1 from sysfiles where '2009-06-01' = '2009-06-01' 正确!!
select 1 from sysfiles where '2009-06-01' = '2009-6-1'
这肯定是不成立的。
因为是两个字符串。
但是作为日期他们是等的。也就是select 1 from sysfiles where cast('2009-06-01' as smalldatetime) = cast('2009-6-1' as smalldatetime)这是OK
select 1 from sysfiles where '2009-06-01' = '2009-06-01' 正确!!