Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 TSQL stored procedure and XQuery?

Author  Topic 

tonyclifton
Starting Member

12 Posts

Posted - 2010-09-23 : 10:52:09
Hello,

I want to write a stored procedure that queries XML files after I have input a certain pattern to look for.

I'm already stuck at the input parameters, consider the following XML-document.


<root>
<container>
<element>A</element>
<option>1</option>
</container>
<container>
<element>B</element>
<option>-1</option>
</container>
<container>
<element>C</element>
</container>
</root>


What I want to achieve is find and output a certain pattern (element-tag and option-tag)to a table.
For example: EXEC search "A1,B-1,C" would be true and needs to be put in a table. But "A,B,C" would be false.

I'm not that great with TSQL, so I don't know how I could split or arrange the search pattern so that I could use this to work with both element-tag and option-tag and put them into variables or so.

Does anyone know how this can be achieved?
Any idea that gets me started seems better than none at the moment

Thanks in advance
   

- Advertisement -