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.
All i want to do is get the raw text out of a XML field.
SQL Server 2008 does not allow cast or convert to text. When I convert to nvarchar(max), 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?
I am using ADODBPHP
$sql = "SELECT [IndicatorID]
,[LitpMultiYearXml]
,[LitpComparisonXml]
FROM [MD_SPP_0910].[dbo].[SppResult]
where IndicatorID = ".$_GET['indicator_id'];
$xml = $db->GetRow($sql);
//echo $sql;
$multi_year = $xml[1];
$multi_year = htmlspecialchars(str_replace(">",">\n",$multi_year));
echo "<textarea name='xml' cols='80' rows='20'>$multi_year</textarea><input type='hidden' name='indicator_id' value='$indicator_id'/>";
This was Correct!
i thought the inner cast would limit it, but i was wrong!