我注册表里有个时间列time
用的是datetime型
我想取出某天内注册的人员信息,比如2007-09-22
总不会是写
where time>2007-09-22 00-00-00.000 and time<2007-09-22 23-23-59.000
吧或者有什么更好的保存时间的方法,望指点指点啊

解决方案 »

  1.   

    where time between 2007-09-22 00-00-00.000 and 2007-09-22 23-23-59.000
    或者
    where substring(time,1,10)='2007-09-22'
      

  2.   

    我注册表里有个时间列time
    用的是datetime型
    我想取出某天内注册的人员信息,比如2007-09-22-----------------
    select * from t where convert(varchar(10),time,120)='2007-09-22'
      

  3.   

    还可以这样写:
    select time from table 
    where year(time)=2007 and month(time)=9 and day(tim) = 22
      

  4.   

    先谢了
    select * from t where convert(varchar(10),time,120)='2007-09-22'
                                                   ----
    这个“120”指的是什么意思呢
    我换成别的后就不行了