如何从 SQL Server 2008 XML 字段中选择大于 8k 个字符的字符串
我正在构建一个小型 php 应用程序,它只是从数据库中提取 XML 字符串,并将整个字符串显示在文本区域内的页面上。听起来很简单,对吧?当我这样做时,我达到了 8k 字符限制,并且我的 XML 被截断。
我想做的就是从 XML 字段中获取原始文本。
SQL Server 2008 不允许强制转换或转换为文本。当我转换为 nvarchar(max)
时,我得到的信息比不转换时多一点,但它仍然被截断。使用 GUI,我可以选择该字段并打开它以显示所有文本......您如何以编程方式执行此操作?
我正在使用 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'/>";
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'/>";
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这是正确的!
我以为内部演员会限制它,但我错了!
This was Correct!
i thought the inner cast would limit it, but i was wrong!