Hi,
I want to use PIVOT to transfer my rows data to columns(for example in
10 rows one columns is price which has prices of each month). The
result is showing 10 rows and column containing price.
I want to see price of 10 rows(for each month) in column manner means
for result should display row along with all prices in each column one
after another.
The PIVOT can be used very well but in my case the result rows are not
fixed so that result no of columns also.
Please suggest me that how can I transform dynamic number of rows to
columns.
if anyother method will solve the problem please suggest.
Thanks,
AnuragCurrently the PIVOT operator does not support dynamic pivoting. Here are a
few resources on how it can be accomplished:
http://www.sqlmag.com/Articles/ArticleID/93907/93907.html
http://www.sqlmag.com/articles/index.cfm?articleid=94268
http://www.sqlmag.com/articles/index.cfm?articleid=15608
http://www.sqlteam.com/item.asp?ItemID=2955
Also, most reporting tools have very good support for pivoting/cross tab
functionality. That might be a better options based on your
situation/requirements.
If you feel this is a much needed functionality in SQL Server, you can vote
to have it implemented here:
http://connect.microsoft.com/SQLServer/feedback/ViewFeedback.aspx?FeedbackID=127071
HTH,
Plamen Ratchev
http://www.SQLStudio.com
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment