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 2008 Forums
 Transact-SQL (2008)
 Dynamic pivot

Author  Topic 

vijays3
Constraint Violating Yak Guru

354 Posts

Posted - 2012-04-10 : 07:05:07
Hi all i want to create a dynamic pivot of my table
my table contains
hostname objectid realeasedt
as hba hostmodels
bs hs model hostmode
cs la hostmode

now i want to display the data like
hostname hba hsmodel la
as hostmodels null null
bs null hostmode nulll
and so on...

But my requirement is that objectid columnn dara is
is dynamic this keeps change so can not define
the pivot cplumn hard coded..this should be
chage dynamically...

Please advise

sunitabeck
Master Smack Fu Yak Hacker

5155 Posts

Posted - 2012-04-10 : 07:15:33
Look up Madhivanan's blog here:

http://beyondrelational.com/modules/2/blogs/70/posts/10840/dynamic-pivot-in-sql-server-2005.aspx

http://beyondrelational.com/modules/2/blogs/70/posts/10791/dynamic-crosstab-with-multiple-pivot-columns.aspx
Go to Top of Page
   

- Advertisement -