日期类型有一批函数的,还是比较方便的,不需要转char

解决方案 »

  1.   

    直接用不行吗?convert(Varchar(10),datefield,120)=convert(char(10),查询日期,120)
      

  2.   

    那你用 smalldatetime 这个类型!!
      

  3.   

    用DATEPART(DAY, '日期')
    DATEPART(DAY, '2000-10-12') = 12
      

  4.   

    --用Between and 也行呀
    --如:要查询‘2005-11-11’的记录
    --用 [字段名] between '2005-11-11' and '2005-11-11 23:59:59'