Hi, Im using SP with 2 parameters named @criteria and @value. The @criteria serve as column flag in which column to perform the search eg Supplier and Invoice No and the @value which is the query value.
It seems CASE has the flexibility to meet the requirement but didnt work for me.
<code>
select column1
from myview
where
case when (@criteria='a') then
column1=@value
else
column2=@value
end
</code>
Thanks in advance.



Reply With Quote
