How to split column values to raw values e.g:
col1 values keep on changing to thousands.
col1 col2 col3 col4
1 james gold [email protected]
2 john def [email protected]
This will not guarantee the order of the values among the columns, as the table doesnt have a column to show the order of the columns..If you have a column, like that, you could change select 0 with that column
with cte as( select *,ROW_NUMBER() over(partition by Col1 order by (select 0))as rn from Table1) select * from cte pivot( Max(COL2) FOR rn IN (,, ) )P