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 |
|
kiran
Starting Member
30 Posts |
Posted - 2004-04-13 : 13:22:39
|
| Is there is any way to convert rows to columns in SQL Server ?An Example (The data could grow more) :servers 2 printers 25CPU 700........What I need to do is convert the rows into columns. I want it to look like this:servers printers CPU2 25 700Here is the simple query that gets me my results:Select asset_cateogry, count(asset_category)from tableNamegroup by asset_categoryThanks in advance... |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2004-04-13 : 13:27:25
|
| http://www.sqlteam.com/item.asp?ItemID=2955Tara |
 |
|
|
kiran
Starting Member
30 Posts |
Posted - 2004-04-13 : 13:44:25
|
| Thank you very much Tara. What if i don't have any grouping or sum columns. If it is a simple query but values are not definite.Ex:Select PropertyName, PropertyValue From problems PropertyName PropertyValue------------ ------------FirstName JasonLastName GoldPhone 111-111-111... ....FirstName GeorgeLastName MathewsPhone 222-222-222....How to convert this to FirstName LastName Phone .... .....--------- -------- ----- ----- -------Jason Gold 111-111-1111 .... ....George Mathews 222-222-2222 .... .......... ....... ...... .... .....My problem is PropertyNames are not definite.. they can grow...Thanks again... |
 |
|
|
|
|
|