2011-08-02 92 views

回答

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 
相關問題