title: How do select a string greater then 8k characters out of a SQL Server 2008 XML field
body: <p>I am building a small php application that simply extracts an XML string out of a database and displays the entire string on a page inside a textarea. Sounds simple, right? When i do this, i hit an 8k character limit and my XML is truncated.</p>
  
  <p>All i want to do is get the raw text out of a XML field.</p>
  
  <p>SQL Server 2008 does not allow cast or convert to text. When I convert to <code>nvarchar(max)</code>, I get a little more then without converting, but it's still truncated.  Using the GUI, I can select the field and open it to reveal all the text....how do you do this programmatically?</p>
  
  <p>I am using ADODBPHP</p>
  
  <pre><code>$sql = "SELECT [IndicatorID]
                ,[LitpMultiYearXml]
                ,[LitpComparisonXml]
            FROM [MD_SPP_0910].[dbo].[SppResult] 
           where IndicatorID = ".$_GET['indicator_id'];
  
  $xml = $db-&gt;GetRow($sql);
  //echo $sql;
  $multi_year = $xml[1];
  $multi_year = htmlspecialchars(str_replace("&gt;","&gt;\n",$multi_year));
  
  echo "&lt;textarea name='xml' cols='80' rows='20'&gt;$multi_year&lt;/textarea&gt;&lt;input type='hidden' name='indicator_id' value='$indicator_id'/&gt;";
  </code></pre>