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.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 CONVERSION OF COLUMNS INTO ROWS

Author  Topic 

tvspsekhar
Starting Member

20 Posts

Posted - 2010-03-29 : 01:46:45
Pl help in creating a new table from the existing table converting the columns into rows as shown below.

Existing Table Name: Tower

locno loctype span
1/0 DA+0 332.000
1/1 DD 320.000
1/2 DA+0 300.000
1/3 DD 200.000
1/4 DD 333.000

Required output:

locno 1/0 1/1 1/2 1/3 1/4
loctype DA+0 DD DA+0 DD DD
SPAN 332 320 300 200 33

tvspsekhar

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2010-03-29 : 01:51:46
check out PIVOT operator if you are using SQL 2005/2008


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page
   

- Advertisement -