• Of course, if you use a calendars table you never have to worry about having to code or validate any date calculations ever again. 😛 Sure makes life a lot simpler. Here is how I would get that answer:

    SELECT d.DaysInCalendarMonth

    FROM dbo.dwCalendars d

    WHERE d.CalendarDate = @SomeDate