You are here: Select Query - can I use a Pivot table? « MsSQL Server « IT news, forums, messages
Select Query - can I use a Pivot table?

Posted by das on 11/15/06 16:33

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

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация