可能重复:
T-SQL stored procedure that accepts multiple Id values
USE [dbindia]
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
alter proc [procedurename]
@srchtxt varchar(50),
@status varchar(50),
@id int
as
select a.listtitle as productname,a.listdesc as description,buyingprice as Price,b.catname as [Primary Category],c.catname as [Secondary Category],d.catname as [Tritary Category],e.catname as [Quartery Category],
a.balanceqty as [Current Stock],
'http://ghsindia.biz/image/product/'+a.imgname as Image1,
'http://ghsindia.biz/image/product/'+a.imgname2 as Image2,
'http://ghsindia.biz/image/product/'+a.imgname3 as Image3,
'http://ghsindia.biz/image/product/'+a.imgname4 as Image4,
'http://ghsindia.biz/image/product/'+a.imgname5 as Image5 from
tbllisting a inner join tblcategory b on a.catid=b.catid
left outer join tblSeccategory c on a.catid2=c.Seccatid
left outer join tbltricategory d on a.catid3=d.tricatid
left outer join tblquarcategory e on a.catid4=e.quarcatid
where a.blockstatus=@status and a.listtitle like '%'+@srchtxt+'%' and a.bstatus=1
**and a.listid in (@id)** order by a.listtitle
这是我的存储过程。我希望获得a.listid
可以是一个或多个的所有值,但如果id的值类似于(1,2,3)