I have some commonly alike problem but its different from dynamic pivot unpivot
Input Table | |||||
ID | Value | ||||
Guid1 | Val1 | ||||
Guid1 | Val2 | ||||
Guid1 | Val3 | ||||
Guid1 | val4 | ||||
Guid2 | asd | ||||
Guid2 | asd | ||||
Guid2 | asd | ||||
Guid3 | test | ||||
Guid4 | Lee | ||||
Guid4 | Jack | ||||
Guid4 | Arnol | ||||
Guid4 | wan | ||||
Guid4 | Swin | ||||
Output Table | |||||
ID | Col1 | Col2 | Col3 | Col4 | Col5 |
Guid1 | Val1 | Val2 | Val3 | val4 | NULL |
Guid2 | asd | asd | asd | NULL | NULL |
Guid3 | test | NULL | NULL | NULL | NULL |
Guid4 | Lee | Jack | Arnol | wan | Swin |
I have to group by my input rows based on ID & rotate them to fixed 5 column table if values are not there I have to fill with NULL.
Kindly let me know if you need more clarification on the problem
I'm looking for solution in Either SSIS or T-SQL.