查询当月天数: select datepart ( day , dateadd ( day , - 1 , dateadd ( month , 1 , cast ( cast ( year ( getdate ()) as varchar ) + ' - ' + cast ( month ( getdate ()) as varchar ) + ' -01 ' as datetime ))))