I have a few items in the database in the form as below:
ID|ColName|ColValue
-------------------
1 |A      |1testa
1 |B      |1testb
1 |C      |1testc
1 |D      |1testd
2 |A      |2testa
2 |D      |2testd
I need data in the form below:
ID| A      | B      | C      | D
1 | 1testa | 1testb | 1testc | 1testd
2 | 2testa | NULL   |   NULL | 2testd
I have tried using PIVOT in T-SQL but it takes aggregate function as argument, which I do not want to supply.
How can I achieve this.
 
     
    