How can I make a multi search SPROC/UDF by passing a tabled-value to it?

Posted by Shimmy on Stack Overflow See other posts from Stack Overflow or by Shimmy
Published on 2009-07-26T04:12:03Z Indexed on 2010/04/28 15:13 UTC
Read the original article Hit count: 279

Filed under:
|
|
|
|

I actually want to achieve the following description

This is the table argument I want to pass to the server

<items>
    <item category="cats">1</item>
    <item category="dogs">2</item>
</items>    

SELECT * FROM Item
    WHERE Item.Category = <one of the items in the XML list> 
    AND Item.ReferenceId = <the corresponding value of that item xml element>

--Or in other words:
SELECT FROM Items
    WHERE Item IN XML according to the splecified columns.

Am I clear enought?

I don't mind to do it in a different way other than xml. What I need is selecting values that mach an array of two of its columns' values.

© Stack Overflow or respective owner

Related posts about sql-server

Related posts about stored-procedures