I'm wondering how others handle this situation... and how to apply the Don't Repeat Yourself (DRY) principle to this situation.
I find myself constantly PIVOTing or writing CASE statements in T-SQL to present Months as columns. I generally have some fields that will include (1) a date field and (2) a value field. When I present this back to a user through an ASPX page or Reporting Services I need to have the last right-most 14 columns to have this pattern:
[Year],[Jan],[Feb],[Mar],[Apr],[May],[Jun],[Jul],[Aug],[Sep],[Oct],[Nov],[Dec],[Total]
Where year is the year as an int and every other field is the value field summed for that month (except for [Total] which is the total value field for the year).
I'd like to find one re-usable way to handle this. Open to all suggestions (T-SQL / ANSI SQL)