title: select rownumber in xquery and convert it to sql rows
body: <p>i have a table which i save user's search result rows in xml format as follows :</p>
  
  <pre><code>&lt;row id="5083" /&gt;
  &lt;row id="5085" /&gt;
  &lt;row id="5087" /&gt;
  &lt;row id="5090" /&gt;
  &lt;row id="5094" /&gt;
  ... (about 500,000 rows)
  </code></pre>
  
  <p>where each row element contains id of the result record which will be shown in result page.
  now i need to select ids of one specific page for example page 2 ( 10th element to 20th element )</p>
  
  <p>the first problem is how can i get that result in xquery ?
  i tried to use position() function but it didn't work ...</p>
  
  <pre><code>select @results.query('for $x in (row)
  where $x/position() &gt; 10
  return ($x)')
  </code></pre>
  
  <p>and the second prblem is how can get my result ids as sql rows instead of xmlnodelist ?</p>