Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

How to add parameter into query

select t0.cardcode, t1.itemcode, t1.[year], t1.[month], sum(t1.nettamnt)[Sales], sum(t1.nettgp)[GP] from ocrd t0 inner join [DEV].[dbo].[2yearbycarditem] t1 on t0.cardcode = t1.cardcode

WHERE t1.ItemCode like '12V%'

group by t0.cardcode, t1.itemcode, t1.[year], t1.[month]

order by t0.cardcode, t1.[year],t1.[month]

how do i change this so the itemcode is a parameter. They need to enter an itemcode that starts with e.g. 12V

I have tried

WHERE t1.ItemCode like '%' + @itemcode + '%'

this does not work.

please help

thanks in advance- Janice

Former Member
Not what you were looking for? View more on this topic or Ask a question