请查看下表,
RowID Name Age
1 Karhik 26
我希望结果格式低于
Column1
1
Karthik
26
答案 0 :(得分:2)
DECLARE @Table table( RowID int, Name varchar(10), Age int )
insert into @table
select 1,'Karhik',26
--Show original row
select * from @table
--Unpivot Row
select Value
from
(select cast(rowid as varchar(10)) as rowid, name, cast(age as varchar(10) )as age from @table) as x
UNPIVOT
(Value FOR [Column] IN
(rowid, name, age)
)AS unpvt