Hi I am trying in SQL Server the pivoting for the following table
REFID | COL1 | COL2 | Sequence
1 abc cde 1
1 lmn rst 2
1 kna asg 3
2 als zkd 2
2 zpk lad 1
I want the output as
COLNAME REFID | 1 | 2 | 3
COL1 1 abc lmn kna
COL2 1 cde rst asg
COL1 2 zpk als null
COL2 2 lad zkd null
The number of columns in the original table are known but the number of rows are not known. Can any one help