我用的my97控件取得的时间日期格式是:2010-01-25 MSSQL数据库里日期格式是:2010-01-25 09:23:04 2010-01-25 17:18:05 我想在需要按天做查询。查询语句应该怎么写?

解决方案 »

  1.   

    select convert(varchar(10),'2010-01-25 09:23:04 ',120) 
      

  2.   

    convert(varchar(10),日期字段,120) = '2010-01-25'
      

  3.   

    select getdate()
    /*
                                                           
    ------------------------------------------------------ 
    2010-09-18 20:49:10.983(所影响的行数为 1 行)
    */select convert(varchar(10),getdate(),120)
    /*
               
    ---------- 
    2010-09-18
    */
      

  4.   

    select * 
    from tb
    where datediff(day,col,控件日期)=0
      

  5.   

    是这个意思?判断属于这一天?
     select * from tb where col between '2010-01-25' and dateadd(dd,1,'2010-01-25')
      

  6.   


    "select * from xx where input_time = '"+rs+"'"
    忘记说了 用变量 rq 字段名是 input_time
      

  7.   

    曾经用过 "select * from xx where datediff(d,input_time,'"+rs+"')";
    但是没成功,不能正常输出。
      

  8.   

    "select * from xx where datediff(d,input_time,'"+rs+"')=0";少敲了东西,但是也没成功。 
      

  9.   


    select * from tb where datediff(day,starttime,getdate())>=0