In reporting Services, the user can choose a list with different customers. The report then generates total figures for the chosen customers. I have 2 tables in the report that incorporate the total revenue. However, when you choose all customers, the totals of the 2 tables differs. For every individual customer however, the tables match.
In the first table I use a simple query like this:
select revenue from customers where customernumber in (@CustomerNumber)
This one always shows the correct figures. However, for the second table, I have to call a stored procedure:
create procedure calculaterevenue (
@customernumber varchar(1200), @customercategory varchar(255)=NULL
)
In the procedure, a table valued function is used to take all the customernumbers that are in a comma-separated list and make then usable for the in operator:
and customernumber in (select value from fnStringToList',',@customernumber)
In the Dataset of the report, I have added an parameter @Customers that is
=JOIN(Parameters!Customernumber.Value,",")
And I call my procedure with
exec calculaterevenue (@Customers)
This works perfectly, until you select a lot of customers. I suspect the problem lies within the JOIN. Is there a maximum output for the JOIN statement?