0

可能重复:
接受多个 Id 值的 T-SQL 存储过程

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) 将如何写入

4

0 回答 0