Question : Getting total number of days in a Month

Hi,
I am using SQL Server 2000.
How can I get the total number of days in month.
for ex.,
If I use getdate(),
Since jan 2003 contains 31 days,
I want the result as 31.
If the date is '20/02/2003' then the result should be 28.
Is it possible.

Cheers

Answer : Getting total number of days in a Month

Oops, forgot Februari ...

RETURN CASE WHEN DatePart(mm,@Date) IN (1,3,5,7,8,10,12) THEN 31 ELSE DateDiff(day,@Date,DateAdd(mm, 1, @Date)) END
Random Solutions  
 
programming4us programming4us