Sqlserver
 sql >> Base de Dados >  >> RDS >> Sqlserver

Como dinamizar colunas de texto no SQL Server?

Select severity_id, pt.People, Assets, Environment, Reputation
FROM 
(
    select * from COMM.Consequence
) As Temp
PIVOT
(
    max([DESCRIPTION]) 
    FOR [TYPE] In([People], [Assets], [Environment], [Reputation])
) As pt