I have a table:
ID Name
-- -----
1 aaa
2 bbb
2 ccc
2 ddd
3 eee
3 fff
4 ggg
5 hhh
I need to pivot this table so that the resulting table looks like this:
ID Name1 Name2 Name3 Name4 Name5 Name6
-- ----- ----- ----- ----- ----- -----
1 aaa NULL NULL NULL NULL NULL
2 bbb ccc ddd NULL NULL NULL
3 eee fff NULL NULL NULL NULL
4 ggg NULL NULL NULL NULL NULL
5 hhh NULL NULL NULL NULL NULL
I have to use this on tables generated by XML Source in SSIS.
Please help!
Assuming your table is called Test: