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?