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
 how to copy rows to columns

Author  Topic 

bhasi83
Starting Member

1 Post

Posted - 2007-08-14 : 02:19:01
i have data in a table..
i want the values in the rows to place in columns and columns into rows..
for ex:-there is one table
name id dept
a 1 x
b 2 y
c 3 z
i want the resultant table should look like this
a b c
1 2 3
x y z

ashley.sql
Constraint Violating Yak Guru

299 Posts

Posted - 2007-08-14 : 08:35:10
are you using sql server 2000 or 2005

Ashley Rhodes
Go to Top of Page

rmiao
Master Smack Fu Yak Hacker

7266 Posts

Posted - 2007-08-14 : 21:48:49
Take look at cross-tab report in sql2k, or pivot operator in sql2k5.
Go to Top of Page
   

- Advertisement -