|
-
Aug 20th, 2012, 10:55 AM
#1
Thread Starter
Fanatic Member
Using WHERE CASE in SP
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.
Learn something new every .001 second. 
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|