Select * From Tablename Where  Convert(Varchar(5),birthday,110) ='05-17'

解决方案 »

  1.   

    where right(convert(varchar(10),birthday,120),5) ='05-17'
      

  2.   

    select right(convert(char(10),birthday,120),5)='05-17'
      

  3.   

    where datepart(mm,birthday)=5 and datepart(dd,birthday)=17
      

  4.   

    select * from 表 where right(convert(char(10),birthday,120),5)='05-17'
      

  5.   

    WHERE CONVERT(CHAR(10), birthday, 120) LIKE '%05-17%'
      

  6.   

    where month(birthday)='5' and day(birthday)='17'
      

  7.   

    我的经验是:
      如果和日期相关的查询比较重要,比如要根据日期为条件生成报表什么什么,我就在表里加三个字段:theYear、theMonth、theDay,分别存放与某个日子(比如2000-1-1)相距的年数、月数、天数。这样如果想看2001-1的月报,只要theMonth=13就可。
      相应的,在应用程序中和数据库中各加三个计算差值的三个函数toYear()、toMonth()、toDay()备用。