0

I might have my terminology mixed up here but to me a dynamic pivot means the data that will become the columns isn't known at design time of the query. I've seen some examples that seem to mean something else, but I've seen some examples where you first distinct to get the unique values then build a query. This seems very cumbersome at best. Does SQL Server 2012 have a more built in way (like MS Access's crosstab query) to pivot on data that isn't known at design time right in 1 sql command?

This was talked about in the year 2012 by not 1 sql statement, but a chunk of code. I'm wondering if SQL Server 2012 has anything new to offer to do it all in 1 command like MS Access does.

user441521
  • 6,942
  • 23
  • 88
  • 160
  • 1
    Possible duplicate of [SQL Server dynamic PIVOT query?](http://stackoverflow.com/questions/10404348/sql-server-dynamic-pivot-query) – Kyle Hale Oct 14 '15 at 15:58
  • That's from the year 2012 and it doesn't answer the question if there is a new way to handle this besides getting the unique values first and then making a pivot. I'm looking for new relevant information with SQL Server 2012. – user441521 Oct 14 '15 at 16:04
  • 1
    I don't think so because SQL Server needs to 'compile' your T-SQL code and every column must be known at that time. – qxg Oct 14 '15 at 16:10
  • 1
    @user441521 Sorry, I should've been more clear: no there is not a new way, that is the way to do it, yes, it is mildly cumbersome. Structured Query Languages don't really care for dynamism. – Kyle Hale Oct 14 '15 at 16:15

0 Answers0