|
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]
|