Error with Database Pivot


I am getting following error when I use Database Pivot.

SQL internal parse tree depth exceeds its maximum: join depth exceeds its maximum:255

I could overcome this issue if I limit # of rows. Is there a way to overcome this w/o limiting the rows?

Thanks in advance.


the size of the statement that is generated depends on the number of unique value combination in the selected pivot columns as well as if the database supports CASE statements or not. What database are you conencting to and how many unique combinations are possible for your pivot columns?