Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
chriztoph
Posting Yak Master
184 Posts |
Posted - 2012-07-09 : 03:56:10
|
Hi everyone,Need help here.how do i convert a column into rows?sample data:ID Value1 Value2 Value31 T0001 Desc 10002 T0002 test sampleprefered output:Much better if you can give the script for thisID Attribute Value1 Value1 T00011 Value2 Desc1 Value3 10002 Value1 T00022 Value2 test2 Value3 samplethanks in advance |
|
ahmeds08
Aged Yak Warrior
737 Posts |
Posted - 2012-07-09 : 04:35:06
|
try using the pivot function. |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2012-07-09 : 09:48:02
|
it should be unpivotSELECT *FROM Table tUNPIVOT (Value FOR Attribute IN ([Value1],[Value2],[Value3]))u ------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
|
|
chriztoph
Posting Yak Master
184 Posts |
Posted - 2012-07-11 : 01:27:53
|
thanks visakh16. |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2012-07-11 : 10:29:41
|
wc------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
|
|
|
|
|