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)
 How to prevent default ordering in PIVOT table

Author  Topic 

girishgoa
Starting Member

1 Post

Posted - 2012-04-19 : 23:10:41
Hi,
I passing sorted data to Pivot table for display, everything works fine but it follows its own default ordering on first column, which I dont want. Is there a way to skip defalt ordering or add some extra dummy column for sorting but make it unvisible. Let me know your suggestions.
Code bits below:
Select * from sorted_table
PIVOT
(
sum(TotalValue)
for PivotColumn in (
' + @pivotColumnHeaders + '
)

) as results
Thanks in advance.

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2012-04-20 : 15:15:47
can you show with sample data what sorting you want in your resultset?

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -