2011-09-07[sqlserver查詢時間字段爲今天的數據]

 --1.
select   *   from   tablename   where   day(會員生日字段名)=day(getdate())   and   month(會員生日字段名)=month(getdate())
--2.
select   *   from   tablename   where   datepart(day,會員生日字段名)=datepart(day,getdate())   and   datepart(month,會員生日字段名)=datepart(month,getdate())
--3.
select   *   from   tablename   where   right(convert(varchar(10),會員生日字段名),8)=right(convert(varchar(10),getdate()),8)
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章