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
 SQL Server 2000 Forums
 Transact-SQL (2000)
 Create dynamic column header

Author  Topic 

jipo
Starting Member

4 Posts

Posted - 2009-01-17 : 08:40:45
Hi, I need some help.
I want to make column-header from row value.

Ex:
select name "x" from table

I want to change the column-header"x" from my another table row value

example :


The column header activity 1 to 3 base on table activity where sch_id from my input. if sch_id=2, the column header after name is only activity4.

Is it possible ? How?
Thanks

TG
Master Smack Fu Yak Hacker

6065 Posts

Posted - 2009-01-17 : 08:50:59
Are you looking for a cross tab effect where you pivot the rows into columns? If not, what are you trying to accomplish? It's possible using dynamic sql but almost always a bad idea.

Be One with the Optimizer
TG
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2009-01-17 : 08:58:40
show some sample data and explain what you want with reqd output
Go to Top of Page

jipo
Starting Member

4 Posts

Posted - 2009-01-17 : 09:16:31
added an example
Go to Top of Page

sodeep
Master Smack Fu Yak Hacker

7174 Posts

Posted - 2009-01-17 : 11:25:01
Search for Dynamic Cross tabs in this forum.
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2009-01-17 : 11:26:09
http://sqlblogcasts.com/blogs/madhivanan/archive/2007/08/27/dynamic-crosstab-with-multiple-pivot-columns.aspx
Go to Top of Page
   

- Advertisement -