I have a SSRS report which runs from a stored procedure. I’ve got 2 parameters that must be chosen. My first parameter works perfectly, but when the 2nd parameter is chosen (Rep) it gets ignored by the report and returns all the Reps.
@Town Varchar(100)
,@Rep Varchar(100)
select
a.Customer
,a.CustName
,a.Rep
,a.Town
,a.Qty
,a.SalesType
,b.Qty1
,c.Qty2
......
from #1 a
left join #2 b
on a.Rep = b.Rep
and a.Town = b.Town
and a.Customer = b.Customer
and a.SalesType = b.SalesType
left join #3 c
..........
WHERE ('ALL' IN (@Town)) OR (a.Town IN (@Town))
and ('ALL' IN (@Rep)) OR (a.Rep IN (@Rep))
Guessing here, but I am assuming you want the clauses for
@Townand@Repto be evaluates as a group each. To do so:As you have it, since each clause is stand alone, you will get short circuit behavior.