Obs (4/28/2011)
Well played!Slope (4/27/2011)
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
Only if the Calendars table was created using a LOT differant math than the one presented for this function.