Situatie
Mai jos este o functie ce primeste ca parametri luna si anul si returneaza numarul de zile pe care le are luna aleasa.
Solutie
create function MonthNoOfDays_fct
(
@Month smallint,
@Year int
)
returns smallint
as
begin
return(
DAY(
dateadd(dd,-1,DATEADD(m,1,cast(@Year as varchar(4)) + ‘-‘ +
cast(@Month as varchar(2)) + ‘-01’))
)
)
end
Leave A Comment?