here's my 2p
print convert(datetime,cast(2009*10000+3*100 + 5 as varchar(8)),112)
just wondered exactly the same question...in fact here is my last day of the month bit
set @DealDateTo=dateadd(dd,-1,dateadd(mm,1,convert(datetime,cast(@DealYear*10000+@DealMonth*100 + 1 as varchar(8)),112)))