Re: Rewrite a WHERE clause



just add "= 1" to the end

here is a working example:


where (case when @arg is null then
case when
[property_id] = 1 //put your test when @arg is null here
then 1 else 0 end
else
case when
[property_id] = 2 //and your other one here
then 1 else 0 end
end) = 1

.