Unix Technical Forum

Select Query - can I use a Pivot table?

This is a discussion on Select Query - can I use a Pivot table? within the SQL Server forums, part of the Microsoft SQL Server category; --> Hello all, I have tried this in SQL 2000 with no luck, with pivot table feature in 2005 I ...


Go Back   Unix Technical Forum > Database Server Software > Microsoft SQL Server > SQL Server

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 03-01-2008, 12:35 PM
das
 
Posts: n/a
Default Select Query - can I use a Pivot table?

Hello all,
I have tried this in SQL 2000 with no luck, with pivot table
feature in 2005 I see some hope. Here is my problem, I have a table
with n rows. data within these is simple varchar. I want to pull the
data in these rows and create a table.

Ex:
Table1 data looks like this (actual table is much much bigger):

# columnName
-- -------------------
1 Name
2 Age
3 City


I want to create a table which has 'Name, Age, City...' as the columns
in it. So basically I am moving a table sideways as in Excel. I can now
do this using a dirty cursor that reads all the columns in the first
table into a param and then I build a 'Create table' out of it and use
dynamci SQL to run it.

this is ugly since and it not recommended for various reasons. Question
now is can I use the Pivot table to some how magically create a table
out of the first table? if so please advice SQL gurus. It will be a
great help for me.

thanks
adi

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 02:19 PM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com