SDU Tools: Calculate Date Dimension Columns in T-SQL
Calculating the columns required for a date dimension using T-SQL is a pretty common request from SQL Server developers. So we decided to make it really easy to do. In our free SDU Tools for developers and DBAs, there is a table-valued function called DateDimensionColumns, for just this purpose.
You supply a date, and the month that your financial year starts in, and it supplies the output columns.
You can also easily combine it with our DatesBetween function to get dimension columns for a range of dates:
2019-02-13