Hi, I was somewhat surprised and happy to see that the t-sql statement below can be used to dynamically build my pivot column headers. I was also surprised to see that either it is smart enought to build the headers alphabetically or I'm
incredibly lucky. Date is a char(7) column in my table with format yyyy/mm.
Anyway, it would be really cool for me if the headers were build descending instead of ascending. I tried using a view to do this but the thing has a mind of its own. I'll start writing a function but would like to know if the community knows
of a better way.
It generates a string that looks something like ...