title: SQL Dynamic Pivot Query in SSRS 2005
body: <p>In my Sql Server Reporting Services (SSRS) 2005 report, I have a query that performs a Pivot and results in a dynamic column list. I closely followed the example in <a href="http://www.simple-talk.com/community/blogs/andras/archive/2007/09/14/37265.aspx" rel="nofollow">http://www.simple-talk.com/community/blogs/andras/archive/2007/09/14/37265.aspx</a>.</p>
  
  <p>Now, the problem is my query can return different columns and I don't know the names of those columns when I'm designing my SSRS report. The query runs fine under the Data tab of the report designer, but the layout designer does not know my column names and it won't let me assign fields to be displayed.</p>
  
  <p>Is there a way to do this? can I dynamically layout the dataset fields in code? can I access data columns in the data set by position rather than name? </p>