Please help me
Conversion failed when converting the varchar value '2,15,19,20,21,22,23,24,25,26' to data type int.
when i change the field type int to varchar then no record no error show.
i try it manually when i type the (2,15,19,20,21,22,23,24,25,26) list then show the record fine. But when I pass this value list by the 'variable' then show the error "Conversion failed when converting the varchar value to data type int."
Please help me sir
https://ibb.co/iarjup
https://ibb.co/gGDfZp
What I have tried:
Alter Proc [dbo].[P_getPurchaseInvDetByID]
--@Sdate date,
--@EDate Date,
@purinvid varchar(50) ,
@itemidlist_pr varchar(500)
begin
Select id.purinvid,id.slno,i.itemnm ,i.itmcod,i.itmdescription,h.hsnnumber,
id.PDQty,id.PDMRP,id.PDRate,id.PDdis,id.pdcgst,id.cgstamt,id.pdsgst,id.sgstamt,
id.pdigst,id.igstamt,id.TaxableAmt,id.totaltaxamt,id.PDAmount,id.ItemIDpur,id.itemhsnid ,c.catnm,sc.subcatnm
from tbl_pur_invdet as id
INNER JOIN tbl_item AS i ON id.itemIDpur =i.itemid
INNER JOIN tbl_HSN_Master AS h ON id.itemhsnid = h.HsnId
INNER JOIN tblcat AS c ON c.catid=i.ITMcatid
INNER JOIN tblsubcat AS sc ON sc.subcatid=i.ITMsubcatid
where purinvid=@purinvid and id.ItemIDpur in (CAST((@itemidlist_pr) AS INT))--('2','15','19','20','21','22','23','24','25','26') --(@itemidlist_pr)
order by id.slno
end