Pivots with Dynamic Columns in SQL Server 2005

Found a great article at www.simple-talk.com which described how to create pivot queries with dynamic column names.  It seems simple at first until you try to adjust your columns manually and then discover that you really need to implement some special code to accomplish the task.  The article Pivots with Dynamic Columns in SQL Server 2005 provides just the right information to accomplish the task and saved me a ton of time trying to create the process on my own.  Great job Andras.

2 Responses to “Pivots with Dynamic Columns in SQL Server 2005”

  • Ferenc:

    Dear Andras!

    For me isn’t working. :(
    It is said The name ‘Select …’ is not a valid identifier.

    When I copy the @query content SQL syntax, and run in a new query it’s completted succesfully.

    Can you help me?

  • Can you post the code you used? It sounds like you just have some quotes missing or something like that.