Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Display Data

Author  Topic 

Charl
Starting Member

2 Posts

Posted - 2010-09-02 : 03:50:44
Hi,
I need to know if this is even possible to do with sql. Any input would be useful.

I have a table :


Name Value aType (all varchar)
------------------------------
Age 5 smallint
Color blue varchar(10)
Working true varchar(10)
Balance 500 money
.... ... .....


I need a function/procedure that outputs the following :

Age Color Working Balance .....
--------------------------------------
5 blue True 500 .....


The idea is that i can do this

Select age,balance from fn_Attributes









kashyap_sql
Posting Yak Master

174 Posts

Posted - 2010-09-02 : 04:01:32
http://bytes.com/topic/sql-server/answers/531936-convert-rows-into-columns
try this link

With Regards
Kashyap M
Go to Top of Page

Charl
Starting Member

2 Posts

Posted - 2010-09-02 : 04:47:11
I had a look at that link. The problem is that you need to know the columns before hand to do it. So there is a set number of columns defined. I need the columns to grow for each row in in the table. Each time a user adds an attribute the resulting table/output from a function has an extra columns.

Is this posible ?
Go to Top of Page

sakets_2000
Master Smack Fu Yak Hacker

1472 Posts

Posted - 2010-09-02 : 04:51:49
http://www.sqlteam.com/article/dynamic-cross-tabs-pivot-tables
Go to Top of Page
   

- Advertisement -