Dynamic Columns for Dynamic SQL
I have created a dynamic SQL program that returns a range of columns (1 -12) based on the date range the user may select. Each dynamic column is month based, however, the date range may overlap from one year to another. Thus, the beginning month for one selection may be October 2005, while another may have the beginning month of January 2007. Basically, the dynamic SQL is a derived Pivot table. The problem that I need to resolve is how do I now use this dynamic result set in a Report. Please keep in mind that the name of the columns change based on the date range select. I have come to understand that a dynamic anything is a moving target! Please advise.
March 9th, 2007 10:24pm

My problem is similar. I have varying number of Columns returned by the dynamic Sql. There is a List control in the ASP.NET page that will return the selected columns(to be displayed in the report). After selecting Columns within the List on the ASP.NET page, I click view report button that will pass the selected Column Names as a delimited String(A,B,C) to the Stored Procedure where I build the Query dynamically as below: @SQL = @SelectClause + @SelectedColumnsClause + @FromClause + @WhereClause. Hence the Result is always dynamic. Issue is to bind the dataset to the Table. Can anybody throw light on this ?
Free Windows Admin Tool Kit Click here and download it now
June 20th, 2011 8:49am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics