declare @xml xml,
declare @num int
set @num = 1
set @xml = '
<row>
<Id>1</Id>
<name>reza</name>
</row>
<row>
<Id>2</Id>
<name>Masoud</name>
</row>
'
how to select ID = @num ??
how to select ID = @num ?? |
||||
|
Use XPath filters:
will show: |
|||||||||
|
|
Try this:
This will return the entire |
|||
|
|
1with@numin marc_s's answer solve your problem? – Mat Dec 22 '12 at 12:54select @xml.query('*[Id/text()=sql:variable("@num")]');should work I think. – Martin Smith Dec 22 '12 at 12:54