DB: SQL Server 2005
We have a table that has data in this manner:
Project Year Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec
-------------------- ----------- --------------------- --------------------- --------------------- --------------------- --------------------- --------------------- --------------------- --------------------- --------------------- --------------------- --------------------- ---------------------
11-11079 2008 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 75244.90
11-11079 2009 466.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
11-11079 2010 855.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
01-11052 2009 56131.00 0.00 36962.00 -61596.00 2428.00 84.00 0.00 0.00 0.00 0.00 0.00 0.00
Someone would like the data to be displayed as one row for the entire project. The columns would be dynamic dependant on how many years it goes into the future. An example would be:
Project Jan-2009 Feb-2009 Mar-2009 Apr-2009... Dec-2009 Jan-2010
-------------- ------------ ------------ ------------ ----------- ------------ ---------
11-11079 466.00 0.00 0.00 0.00 0.00 855.00
01-11052 56131.00 0.00 36962.00 -61596.00 2428.00 0.00
I read of many examples where the date is populated in one column for each entry but I haven't found any cases where the months are the column name and the year is in the row.
Dynamic SQL with a pivot table?
Or some pretty wide scale manipulation using SQL, temp tables, joins and unions?
Any thoughts on using the SSIS pivot table feature?