datediff(day,ol_time,getdate())=0其中ol_time是字段
getdate()是当前时间

解决方案 »

  1.   

    方法很土,但可以解决你这个问题:
    2000-1-1 = cast(Year(2000-1-1 12:00:00) as varchar(4)) + '-' + cast(Month(2000-1-1 12:00:00) as varchar(4))  + '-' +  cast(Day(2000-1-1 12:00:00) as varchar(4))
      

  2.   

    select case when (day('2000-1-1') = day('2000-1-1 12:00:00')) then 'yes' else 'no' end
      

  3.   

    declare @n1 smalldatetime,@n2 smalldatetime
    select @n1='2000-1-1',@n2='2000-1-1 12:00:00'
    if datediff(dd,@n1,@n2)=0
    print '相同'
    else
    print '不相同'
      

  4.   

    if convert(char(10),getdate(),120)=‘2000-1-1’ then 
    print '相同'
    else
    print'不相同'