Does your stored procedure always return the same number of columns? Even if
it doesn't in the first place, you could make it.
Try something like
Select Column1 as Col1, Column2 as Col2, Column3 as Col3, NULL as Col4 to
make sure you always get the same number of columns, and that they are
always called the same.
If your store procedure runs against different tables, you could do
something like this (pseudocode):
If @ParameterTableName = 'sales'
begin
select SalesDate as Col1, SalesCustomer as Col2, SalesItem as Col3, NULL as
Col4 from Sales
end
or @ParameterTableName = 'customers'
begin
select CustomerName as Col1, CustomerID as Col2, CustomerAddress as Col3,
CustomerZip as Col4 from Customers
end
(make sure you use the correct syntax, I'm sure mine is a bit wrong)
You probably want to make sure the different columns contain data of more or
less the same length, so your dynamic data doesn't look too weird when you
put them in the columns.
Kaisa M. Lindahl Lervik
[quoted text, click to view] "rapiddata" <rapiddata@discussions.microsoft.com> wrote in message
news:0A6AA3CC-2862-4284-8DB5-2CC1D225EE80@microsoft.com...
> Is there a way to programatically specify dynamic fields list to be mapped
> to
> reports columns at runtime. The stored procedure returns different fields
> list in the result set and these fields need to be bound to report column
> details.