有一条记录是2006-05-19 07:30的
select *  from t1 where mytime >= '2006-05-19'
不能搜到。 select *  from t1 where mytime >= '2006-05-20'
就可以。为什么>= 是不包括呢?

解决方案 »

  1.   

    --不可能吧:试一下我的例子:)
    declare @t1 table (mytime datetime)
    insert into @t1
    select getdate()select *  from @t1 where mytime > ='2006-05-19'
      

  2.   

    select mytime from t where convert(varchar(10), mytime,120) >= '2006-05-19' 
    and convert(varchar(10), mytime,120) <= '2006-05-19' 可以select mytime from t where mytime >= '2006-05-19' 
    and mytime <= '2006-05-19' 不可以
      

  3.   

    DateTime類型的話,要註意後面的 時分鈔