Friday, June 15, 2012

CHANGE ROW TO COLUMN

CHANGE ROW TO COLUMN USING SIMPLE PIVOT

 

Declare @t table(id int identity(1,1), strfrag varchar(8))

insert into @t values

('1'), ('>'), ('100');

select * from @t

select [1],[2],[3] from @t

pivot (

    max(strfrag)

    for id in ([1],[2],[3])

) as pt;


No comments:

Post a Comment