[quote user="ABSINTHIST"] Great job Frank, but how does this one work? [/quote] I think I've described this technique here http://www.sql-server-performance.com/articles/dev/datetime_datatype_p1.aspx on one page. The only differences between the example in my article and here in my script is the -1 as start date. 0 is the 1st day of January 1900. Adding months' to this date always results in another 1st day of another month. Likewise -1 is the last day of the month before January 1900, that is December 1899. Any number of months' added to this date results in the last day of the previous month. Hope I haven't confused you, I for one sucessfully confused myself now, I think.