SQL计算给定月天数

CREATE FUNCTION FUN_DAYS(@Year varchar(4),@Month varchar(2)) RETURNS TABLE AS
return select top 100 percent @year+'-'+@Month+'-'+rtrim(langid+1) 日期
from master.dbo.syslanguages
where langid+1<=day(dateadd(dd,-1,dateadd(mm,1,@Year+'-'+@Month+'-1')))
order by langid
  

你可能感兴趣的:(数据库)