Quantcast
Channel: Transact-SQL forum
Viewing all articles
Browse latest Browse all 23857

adding input parameter in SP to be used with LIKE operator

$
0
0

Hi All, please advise on below scenario.

In my SP i want to add one parameter @order_type (whose values to be displayed on drop-down list of the report is :

--> "All", "Only FSV", "Only Rx" 

Now, this means in my SP, i am having a field called PROD_CD whose values i need to consider like following :

PROD_CD like 'R4%' then it means Only RX

else Only FSV

(means, CASE WHEN PROD_CD like 'R4%' THEN 'Only RX' ELSE 'Only FSV' END)

How do i go about this using LIKE operator . Along with if user selects All then it should render report based on all kind of products. 

If user selects Only RX then it should render report based on only PROD_CD like 'R4%' 

If user selects Only FSV then it should render report based on records for which  PROD_CD is not like 'R4%' 

Thanks


Viewing all articles
Browse latest Browse all 23857

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>