sql - Can a Parameter in a stored procedure handle a set of rows? -


like title says, example,

   select product_id, price products price > 100 

i need pass records of "product_id" stored procedure...

is possible?

thanks in advance

in general, can use comma separated string / xml data type , pass store procedure

create table product (productid int,productname varchar(100)) insert product(productid,productname) values(1,'a'),(2,'b'),(3,'c') 

get list of productid

declare @productid varchar(50) select @productid=case when isnull(@productid,'')='' convert(varchar(5),productid)  else @productid+','+convert(varchar(5),productid) end dbo.product; 

then pass @productid store procedure. after that, can parse string , insert values temp/variable table processing. in case, want pass more information (productname, price,...), can use xml data type.

if sql server 2008 or higher version, can use table-value parameters http://msdn.microsoft.com/en-us/library/bb510489(v=sql.105).aspx

thanks,


Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -