I need a select statement for a stored procedure with @startDate and @endDate parameters. It needs to return a dynamic amount of columns that are labeled in a month year ("August 2011") format based on the date range parameters.
For example, if @startDate = 1/1/2011 and @endDate = 3/1/2011
the result set would look something like:
column headers ----> January 2011 | February 2011 | March 2011
rows with data ----> 123 | 3456 | 793
a function taking the datetime corresponding to the column header will be used for rows of data
Is this possible? Use pivot? Thanks in advance for all of your responses!