Solved

Script to convert rows into column or vice-versa

Posted on 2004-09-08
2
8,701 Views
Last Modified: 2010-05-18
I need command or script to convert rows into columns or vice-versa in MS SQL 2000. Any one has ideas or commands?
0
Comment
Question by:rsrsm
2 Comments
 
LVL 26

Expert Comment

by:Hilaire
ID: 12004160
Should it be a new table or just a query to make a pivot table ?
Please post sample data, current shape + expected results.

With the information you have given so far, the best I can come with is
- issue a select * in QA
- copy output to an excel file
- use Excel rotate functionality
- change column names at will
- import xl file into a new table using DTS
0
 
LVL 5

Accepted Solution

by:
g0rath earned 250 total points
ID: 12005529
Here is a pivot table stored procedure that I've used and works fairly well.
http://www.sqlteam.com/item.asp?ItemID=2955

Lately I've hand coded these by hand to insure I know what they are doing.
0

Featured Post

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
SQL Replication question 9 43
always on switch back after failover 2 35
Passing Parameter to Stored Procedure 4 24
Present Absent from working date rage 11 21
Having an SQL database can be a big investment for a small company. Hardware, setup and of course, the price of software all add up to a big bill that some companies may not be able to absorb.  Luckily, there is a free version SQL Express, but does …
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Via a live example, show how to extract information from SQL Server on Database, Connection and Server properties
Viewers will learn how the fundamental information of how to create a table.

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question