I have read many question on Stack Overflow related to my problem, but I don\'t think they quite address my problem. Basically I download a XML dataset with lots of data, and in
I think you need to this
1) Take all your Table1 as it is in SQL Server
2) Then run following query
DECLARE @cols AS NVARCHAR(MAX),
@query AS NVARCHAR(MAX)
select @cols = STUFF((SELECT distinct ',' + QUOTENAME(Name)
from [Table1]
FOR XML PATH(''), TYPE
).value('.', 'NVARCHAR(MAX)')
,1,1,'')
set @query = 'SELECT countryid,' + @cols + '
from
(
select NameID, Name
from Table1 cc
) T
pivot
(
max (Name)
for languagename in (' + @cols + ')
) p '
execute sp_executesql @query;