2017-01-30 49 views

回答

2

在参数列表中有一个名为All Customers的选项,该选项是有序的,因此它位于参数列表的顶部。

如果您手动添加参数选项,则此顺序很简单。如果是数据驱动的,你可以在你的参数的数值数据做一个union all以得到正确的次序:

select <Unique value that matches your customer ID type> as Value 
     ,'All Customers' as Label 
     ,1 as SortOrder 

union all 

select CustomerID as Value 
     ,CustomerName as Label 
     ,2 as SortOrder 
from CustomerTable 
order by SortOrder 
     ,Label 

,然后在你的查询,你只需要添加处理这个新All值的逻辑:

select Columns 
from Tables 
where CustomerID = @Customer 
    or @Customer = <Unique value that matches your customer ID type> 
相关问题