1. Craig, can I have an autographed photo of your brain for Chistmas?
2. This is totally cool. I'm trying to figure it all out. I think I'm doing pretty well. Couple questions/confirmations (re: Post #1032106):
CONVERT( DateTime, CONVERT( VARCHAR(20), DateKey)) AS DateKey
I guess this means you can't directly convert an INT to DateTime?
DATEADD( mm, DATEDIFF( mm, 0, CONVERT( DATETIME, CONVERT( VARCHAR(20), DateKey))), 0) AS MonthStartDateKey
Okay, this confuses me. I have taken it apart from the inside out, I understand what DATEADD and DATEDIFF do, but I don't understand the use of "0" here...?
And the REVERSE, STUFF, REPEAT...
, as much as I'd like to pretend to understand it, I don't.
If you feel like elaborating on any of this, I'd love to learn what exactly you're doing.