I'm working on TSQL stored procedure and I need to transform temporary table columns into rows. Currently I'm using updating table one by one but I think using pivot and unpivot this could be achieved this easily.
Data Source:
Periods Stat1 Stat2 Stat3 Stat4
--------------------------------------------------------
Value1 1.011 1.012 1.013 1.014
Value2 1.011 1.021 1.031 1.041
Value3 1.011 2.211 1.311 1.411
Expected Output:
Stats Value1 Value2 Value3
-----------------------------------------------
Stat1 1.011 1.011 1.011
Stat2 1.012 1.021 1.211
Stat3 1.013 1.031 1.311
Stat4 1.014 1.041 1.411
Really appreciate any help on this ?