I have a table of this structure:
Fred Jim John
11......21....31
12......22....null
13......null...null
that I want to pivot to this structure:
Name Value1 Value2 Value3
Fred.....11.........12.........13
Jim.......21........ 22.........null
John.....13.........null........null
(without the dots, of course).
Before I do this, I can determine the maximum number of values a person has, so I can 'name' the columns beforehand, but I need to be able to fit all the data in - padding with blanks or nulls is OK.
I have looked at other answers, but couldn't find an example for an uneven number of values for each row to be created.