0

Possible Duplicate:
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      

This is my stored procedure. I want to get all the values where a.listid can be one or more but how will write in this if values of id is like (1,2,3)

Community
  • 1
  • 1
Gopal
  • 217
  • 1
  • 4
  • 18

0 Answers0