2017-01-30 77 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> 
相關問題