title: Xpath returning NULL for valid Xpath expression
body: <p>I'm using a fairly straightforward Xpath query (below) to query a SQL Server 2008 database column whose values all follow the form of the example (below that). My query returns <code>NULL</code> for all rows, rather than the values of the <code>example</code> attribute (e.g. "VALUE"), even though the <code>example</code> attribute is defined for every row I'm querying.</p>
  
  <p>I've tried declaring the <code>xsd</code> and <code>xsi</code> namespaces in my Xquery expression, and selecting from multiple different attribute names, but neither had any effect. What am I missing?</p>
  
  <p><strong>Query</strong>:</p>
  
  <pre><code>select ColumnName.value('(/RootNode/@example)[1]', 'nvarchar(15)') [Result]
    from TableName
  </code></pre>
  
  <p><strong>XML sample node</strong> (actual XML contains many more attributes, which I've omitted):</p>
  
  <pre><code>&lt;RootNode xmlns:xsd="http://www.w3.org/2001/XMLSchema"
            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
            xmlns="http://intranet"
            example="VALUE"&gt;
    &lt;IsValid&gt;true&lt;/IsValid&gt;
  &lt;/RootNode&gt;
  </code></pre>
  
  <p><strong>Attempted query using namespaces, with same result</strong>:</p>
  
  <pre><code>select ColumnName.value('
  declare namespace xsd="http://www.w3.org/2001/XMLSchema";
  declare namespace xsi="http://www.w3.org/2001/XMLSchema-instance";
  
  (/RootNode/@example)[1]', 'nvarchar(15)') [Result]
    from TableName
  </code></pre>