• rcerney 63319 (11/23/2016)


    I know this is an old post but still such an awesome script. One additional field I added for my use is a fiscal_quarter column at the end. The year quarter is great but our fiscal year begins in October and goes through the following September. I'm sure others have added this as well when needed but in case anyone ever wants it, add a column called fiscal_quarter to the main table at the top of the script and then this to the --Table Update II section

    DC.fiscal_quarter = Case When DC.calendar_month Between 1 And 9 Then CONVERT (VARCHAR (4), DC.calendar_year) + 'Q' + CONVERT (VARCHAR (1), DC.calendar_quarter + 1) Else CONVERT (VARCHAR (4), DC.calendar_year +1) + 'Q' + CONVERT (VARCHAR (1), DC.calendar_quarter -3) end

    Very cool! Thanks for sharing this. I'm sure others will appreciate it and find it very useful! 🙂