Please start any new threads on our new site at We've got lots of great SQL Server experts to answer whatever question you can come up with.

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

SQL Server Forums
Profile | Active Topics | Members | Search | Forum FAQ
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 convert row to the column
 Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Starting Member

United Kingdom
1 Posts

Posted - 11/12/2010 :  23:58:54  Show Profile  Reply with Quote
Hi guys, i have a big problem of creating row as a column.

id | name
1 | A
2 | B
3 | C

i want to change as this...

A | B | C
1 | 2 | 3

i know for you guys, this is not a big issue! could anyone please help me?
thank you

The Chadinator

1974 Posts

Posted - 11/14/2010 :  03:06:39  Show Profile  Visit chadmat's Homepage  Reply with Quote
Look up Pivot in Books Online

Go to Top of Page

Flowing Fount of Yak Knowledge

1693 Posts

Posted - 11/15/2010 :  05:12:12  Show Profile  Reply with Quote
or try like this too
select max(case when name = 'A' then id end) as 'A',
max(case when name = 'B' then id end) as 'B',
max(case when name = 'C' then id end) as 'C'
from table name
Go to Top of Page
  Previous Topic Topic Next Topic  
 Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.02 seconds. Powered By: Snitz Forums 2000