Solved

Script to convert rows into column or vice-versa

Posted on 2004-09-08
2
8,702 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

NAS Cloud Backup Strategies

This article explains backup scenarios when using network storage. We review the so-called “3-2-1 strategy” and summarize the methods you can use to send NAS data to the cloud

Question has a verified solution.

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

This article shows gives you an overview on SQL Server 2016 row level security. You will also get to know the usages of row-level-security and how it works
In this article we will learn how to fix  “Cannot install SQL Server 2014 Service Pack 2: Unable to install windows installer msi file” error ?
Via a live example, show how to backup a database, simulate a failure backup the tail of the database transaction log and perform the restore.
Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.

839 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