SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 Dynamic Pivot
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

daniel50096230
Yak Posting Veteran

Malaysia
98 Posts

Posted - 12/12/2013 :  02:16:30  Show Profile  Reply with Quote
I has the following rows in my columns:

Type_ID

Treatment_Time
Course_Description
Effective_To
Effective_From

How can I pivot them become the following columns and using the type_ID data as column name?
Treatment_Time Course_Description Effective_To Effective_From

By the way, the data in Type_ID column might be different, how can I make a dynamic pivot in order to cater this?

TG
Flowing Fount of Yak Knowledge

USA
6062 Posts

Posted - 12/12/2013 :  11:02:40  Show Profile  Reply with Quote
have a look at this:
http://weblogs.sqlteam.com/jeffs/archive/2005/05/02/4842.aspx

Be One with the Optimizer
TG
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

India
52317 Posts

Posted - 12/12/2013 :  11:08:00  Show Profile  Reply with Quote
see

http://sqlblogcasts.com/blogs/madhivanan/archive/2008/08/27/dynamic-pivot-in-sql-server-2005.aspx

http://sqlblogcasts.com/blogs/madhivanan/archive/2007/08/27/dynamic-crosstab-with-multiple-pivot-columns.aspx

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.06 seconds. Powered By: Snitz Forums 2000