<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Sybase数据库技术，数据库恢复专家 &#187; xml</title>
	<atom:link href="http://www.dbainfo.net/tag/xml/feed" rel="self" type="application/rss+xml" />
	<link>https://www.dbainfo.net</link>
	<description>提供Sybase ASE及Sybase SQL Anywhere数据库修复服务，电话：13811580958(微信)，QQ：289965371！We have many years of experience in recovering data from damanged Sybase devices. Contact us by Phone: +86 13811580958 Wechat: 13811580958 Email: 289965371@qq.com</description>
	<lastBuildDate>Sat, 14 Jun 2025 16:28:02 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>以HTML格式显示ASE查询计划</title>
		<link>https://www.dbainfo.net/showplan_html_format.htm</link>
		<comments>https://www.dbainfo.net/showplan_html_format.htm#comments</comments>
		<pubDate>Tue, 19 Nov 2013 09:53:51 +0000</pubDate>
		<dc:creator>dbainfo</dc:creator>
				<category><![CDATA[Sybase ASE]]></category>
		<category><![CDATA[ASE]]></category>
		<category><![CDATA[ASE V15.7]]></category>
		<category><![CDATA[xml]]></category>
		<category><![CDATA[新特性]]></category>

		<guid isPermaLink="false">http://www.dbainfo.net/?p=2424</guid>
		<description><![CDATA[ASE 15.7 SP100版本开始支持以html格式显示查询计划。 生成html形式的查询计划前需要启用一些会话级别的选项： set statistics plan_html on set statistics timing_html on set statistics plan_detail_html on set statistics parallel_plan_detail_html on set statistics plan_directory_html &#34;e:\&#34; set statistics plan_directory_html on go 在执行SQL语句后，会在e:\发现生成了对应的查询计划html文件。 文件名称格式为：qp_username_spid_timestamp.html，比如：qp_sa_25_2013-11-19T17_48_08.html 使用浏览器打开qp_sa_25_2013-11-19T17_48_08.html，内容截图为： 禁止生成html格式的查询计划，使用选项： set statistics plan_html off set statistics timing_html off set statistics plan_detail_html off set statistics parallel_plan_detail_html off go &#160; 本文链接地址：https://www.dbainfo.net/showplan_html_format.htm； 本文为dbainfo个人原创，请在尊重作者劳动成果的前提下进行转载； 转载务必注明原始出处 : [...]]]></description>
			<content:encoded><![CDATA[<p>ASE 15.7 SP100版本开始支持以html格式显示查询计划。</p>
<p>生成html形式的查询计划前需要启用一些会话级别的选项：</p>
<blockquote>
<p>set statistics plan_html on<br />
		set statistics timing_html on<br />
		set statistics plan_detail_html on<br />
		set statistics parallel_plan_detail_html on<br />
		set statistics plan_directory_html &quot;e:\&quot; <br />
		set statistics plan_directory_html on<br />
		go</p>
</blockquote>
<p>在执行SQL语句后，会在e:\发现生成了对应的查询计划html文件。</p>
<p>文件名称格式为：qp_<em><strong>username</strong></em>_<em><strong>spid</strong></em>_<em><strong>timestamp</strong></em>.html，比如：qp_sa_25_2013-11-19T17_48_08.html</p>
<p>使用浏览器打开qp_sa_25_2013-11-19T17_48_08.html，内容截图为：</p>
<p style="text-align: center;"><a href="https://www.dbainfo.net/wp-content/uploads/2013/11/showplan_in_html_format.png" class="highslide-image" onclick="return hs.expand(this);"><img alt="" height="420" src="https://www.dbainfo.net/wp-content/uploads/2013/11/showplan_in_html_format.png" width="1406" /></a></p>
<p>禁止生成html格式的查询计划，使用选项：</p>
<blockquote>
<p>set statistics plan_html off<br />
		set statistics timing_html off<br />
		set statistics plan_detail_html off<br />
		set statistics parallel_plan_detail_html off<br />
		go</p>
</blockquote>
<p>
	&nbsp;</p>
<div style="clear: both; margin: 10px 0pt; border: 1px dashed rgb(153, 153, 153); font-size: 12px; padding: 5px 10px;">
<li>本文链接地址：<a href="https://www.dbainfo.net/showplan_html_format.htm">https://www.dbainfo.net/showplan_html_format.htm</a>；</li>
<li>本文为dbainfo个人原创，请在尊重作者劳动成果的前提下进行转载；</li>
<li>转载务必注明原始出处 : <a href="https://www.dbainfo.net/">Sybase数据库技术，数据库恢复专家</a>；</li>
<li>对《<a href="https://www.dbainfo.net/showplan_html_format.htm">以HTML格式显示ASE查询计划</a>》有何疑问或见解，请在本文下方发表；</li>
<li>对网站还有其他问题或建议，请提交在<a href="https://www.dbainfo.net/messages" target="_blank">留言板</a>，谢谢！</li>
</div>
<h2  class="related_post_title">相关文章</h2><ul class="related_post"><li>2013-10-15 -- <a href="https://www.dbainfo.net/ase-xml-introduction.htm" title="ASE中xml服务使用方法简介">ASE中xml服务使用方法简介</a> (0)</li><li>2014-10-10 -- <a href="https://www.dbainfo.net/ase-object-name-length-limit.htm" title="ASE对象名称长度限制">ASE对象名称长度限制</a> (0)</li><li>2014-06-09 -- <a href="https://www.dbainfo.net/count_all_tables_rowcount.htm" title="统计用户数据库内所有表的行数">统计用户数据库内所有表的行数</a> (0)</li><li>2013-09-16 -- <a href="https://www.dbainfo.net/select-random-rows-from-table.htm" title="ASE从表中随机选择数据的三种方法">ASE从表中随机选择数据的三种方法</a> (0)</li><li>2013-09-08 -- <a href="https://www.dbainfo.net/get-current-running-sql.htm" title="查看ASE v15正在执行的SQL语句内容">查看ASE v15正在执行的SQL语句内容</a> (0)</li><li>2009-11-18 -- <a href="https://www.dbainfo.net/ase12_5-new-features.htm" title="sybase 12.5各个版本的新功能(转echoaix的博客)">sybase 12.5各个版本的新功能(转echoaix的博客)</a> (0)</li><li>2019-04-12 -- <a href="https://www.dbainfo.net/sybase-ase-asa-recovery-service.htm" title="Sybase ASE及SQL Anywhere数据库修复专家">Sybase ASE及SQL Anywhere数据库修复专家</a> (0)</li><li>2015-01-16 -- <a href="https://www.dbainfo.net/one-way-to-recover-master-configuration-area.htm" title="master数据库配置区域(configuration area)损坏的一种修复方法">master数据库配置区域(configuration area)损坏的一种修复方法</a> (1)</li><li>2014-11-29 -- <a href="https://www.dbainfo.net/ase-15-7-silent-install.htm" title="Sybase ASE 15.7静默方式安装并创建服务器">Sybase ASE 15.7静默方式安装并创建服务器</a> (0)</li><li>2014-05-26 -- <a href="https://www.dbainfo.net/isql_client_password_encryption_fails.htm" title="isql登录ASE报Client password encryption fails问题解决">isql登录ASE报Client password encryption fails问题解决</a> (0)</li></ul>]]></content:encoded>
			<wfw:commentRss>https://www.dbainfo.net/showplan_html_format.htm/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ASE中xml服务使用方法简介</title>
		<link>https://www.dbainfo.net/ase-xml-introduction.htm</link>
		<comments>https://www.dbainfo.net/ase-xml-introduction.htm#comments</comments>
		<pubDate>Tue, 15 Oct 2013 01:59:01 +0000</pubDate>
		<dc:creator>dbainfo</dc:creator>
				<category><![CDATA[Sybase ASE]]></category>
		<category><![CDATA[ASE]]></category>
		<category><![CDATA[ASE V15.0.3]]></category>
		<category><![CDATA[ASE V15.5]]></category>
		<category><![CDATA[ASE V15.7]]></category>
		<category><![CDATA[xml]]></category>

		<guid isPermaLink="false">http://www.dbainfo.net/ase%e4%b8%adxml%e6%9c%8d%e5%8a%a1%e4%bd%bf%e7%94%a8%e6%96%b9%e6%b3%95%e7%ae%80%e4%bb%8b.htm</guid>
		<description><![CDATA[ASE自12.5.1开始在内部处理中支持xml；自15.x版本xml功能得到进一步完善。 ASE15.x中使用xml不需要额外的license。 一、导出xml文档 在ASE的select语句中加入关键字for xml即可以xml格式显示结果集。 语法： 限制： for xml select语句不能包括into_clause、compute_clause、read_only_clause、isolation_clause、browse_clause 或 plan_clause。 不能在命令create view、declare cursor、subquery 或 execute command中指定 for xml select。 不能在以下命令中使用for xml 子查询：for xml select、create view、declare cursor、select into；亦不能将其用作定量判定子查询，如 any/all、in/not in、exists/not exists。 下面举例导出xml格式的SQL查询结果集： 以SQL：select id,name,crdate from sysobjects where type=&#39;S&#39; 为例。 首先，启用 XML服务 sp_configure &#34;enable xml&#34;,1 然后，执行：select id,name,crdate from sysobjects where type=&#39;S&#39; for xml 返回xml格式的结果集。 为了防止出现堆内存(参数：heap [...]]]></description>
			<content:encoded><![CDATA[<p><span style="color:black; font-family:宋体; font-size:10pt">ASE自12.5.1开始在内部处理中支持xml；自15.x版本xml功能得到进一步完善。 </span></p>
<p><span style="color:black; font-family:宋体; font-size:10pt">ASE15.x中使用xml不需要额外的license。 </span></p>
<p><span style="color:red; font-family:宋体; font-size:16pt">一、导出xml文档 </span></p>
<p><span style="color:black; font-family:宋体; font-size:10pt">在ASE的select语句中加入关键字for xml即可以xml格式显示结果集。 </span></p>
<p><span style="color:black; font-family:宋体; font-size:10pt"><strong>语法： </strong></span></p>
<p><img alt="" src="https://www.dbainfo.net/wp-content/uploads/2013/10/101513_0159_ASExml1.jpg" /><span style="color:black; font-family:宋体; font-size:10pt"> </span></p>
<p><span style="color:black; font-family:宋体; font-size:10pt"><strong>限制： </strong></span></p>
<ul style="margin-left: 43pt">
<li><span style="color:black; font-family:宋体; font-size:10pt">for xml select语句不能包括into_clause、compute_clause、read_only_clause、isolation_clause、browse_clause 或 plan_clause。 </span></li>
<li><span style="color:black; font-family:宋体; font-size:10pt">不能在命令create view、declare cursor、subquery 或 execute command中指定 for xml select。 </span></li>
<li><span style="color:black; font-family:宋体; font-size:10pt">不能在以下命令中使用for xml 子查询：for xml select、create view、declare cursor、select into；亦不能将其用作定量判定子查询，如 any/all、in/not in、exists/not exists。 </span></li>
</ul>
<p><span style="color:black; font-family:宋体; font-size:10pt">下面举例导出xml格式的SQL查询结果集：<span id="more-2188"></span></span></p>
<p><span style="color:black; font-family:宋体; font-size:10pt">以SQL：<span style="color:blue">select id,name,crdate from sysobjects where type=&#39;S&#39; <span style="color:black">为例。 </span></span></span></p>
<p><span style="color:black; font-family:宋体; font-size:10pt">首先，启用 XML服务 </span></p>
<p><span style="color:black; font-family:宋体; font-size:10pt">sp_configure &quot;enable xml&quot;,1 </span></p>
<p><span style="color:black; font-family:宋体; font-size:10pt">然后，执行：<span style="color:blue">select id,name,crdate from sysobjects where type=&#39;S&#39; for xml <span style="color:black">返回xml格式的结果集。 </span></span></span></p>
<p><span style="color:black; font-family:宋体; font-size:10pt">为了防止出现堆内存(参数：heap memory per user)不足的情况，建议使用选项：incremental=yes (incremental=yes表示：从指定for xml的select语句中返回多行)。 </span></p>
<p><span style="color:black; font-family:宋体; font-size:10pt">将isql执行结果保存到文件系统上的文本文件，可以实现将ASE表数据保存为xml文档的需求。 </span></p>
<p><span style="color:black; font-family:宋体; font-size:10pt">如下脚本/tmp/xml.sh供参数： </span></p>
<p><span style="color:black; font-family:宋体; font-size:10pt">$cat /tmp/xml.sh </span></p>
<p><span style="color:blue; font-family:宋体; font-size:10pt">UserName=$1 </span></p>
<p><span style="color:blue; font-family:宋体; font-size:10pt">PassWd=$2 </span></p>
<p><span style="color:blue; font-family:宋体; font-size:10pt">ServerName=$3 </span></p>
<p><span style="color:blue; font-family:宋体; font-size:10pt">FullTableName=$4 </span></p>
<p><span style="color:blue; font-family:宋体; font-size:10pt">isql -U${UserName} -P${PassWd} -S${ServerName} -w5000 -b &lt;&lt;EOF </span></p>
<p><span style="color:blue; font-family:宋体; font-size:10pt">set nocount on </span></p>
<p><span style="color:blue; font-family:宋体; font-size:10pt">go </span></p>
<p><span style="color:blue; font-family:宋体; font-size:10pt">set textsize 100000000 </span></p>
<p><span style="color:blue; font-family:宋体; font-size:10pt">go </span></p>
<p><span style="color:blue; font-family:宋体; font-size:10pt">select * from ${FullTableName} for xml option &quot;incremental=yes&quot; </span></p>
<p><span style="color:blue; font-family:宋体; font-size:10pt">--select * from ${FullTableName} for xml all option &quot;incremental=yes&quot; </span></p>
<p><span style="color:blue; font-family:宋体; font-size:10pt">go </span></p>
<p><span style="color:blue; font-family:宋体; font-size:10pt">quit </span></p>
<p><span style="color:blue; font-family:宋体; font-size:10pt">EOF </span></p>
<p><span style="color:black; font-family:宋体; font-size:10pt">脚本使用方法：/tmp/xml.sh sa &quot;&quot; redhat6 &quot;testdb..sysobjects&quot; &gt; testdb..sysobjects.xml </span></p>
<p><span style="color:red; font-family:宋体; font-size:16pt">二、读取xml文档的数据 </span></p>
<p><span style="color:black; font-family:宋体; font-size:10pt">利用ASE中的代理表&amp;CIS组件可以访问操作系统上的目录和文件，进而使用xmlextract提取xml文档的信息。 </span></p>
<p><span style="color:black; font-family:宋体; font-size:10pt">需要启用CIS组件和文件访问参数： </span></p>
<ul style="margin-left: 43pt">
<li><span style="color:black; font-family:宋体; font-size:10pt">检验是否将配置参数 enable cis 设置为1： sp_configure &quot;enable cis&quot;,1 </span></li>
<li><span style="color:black; font-family:宋体; font-size:10pt">使用 sp_configure 启用文件访问： sp_configure &quot;enable file access&quot;,1 </span></li>
</ul>
<p><span style="color:black; font-family:宋体; font-size:10pt">创建执行目录/dev/shm的代理表xmlxfsTab: </span></p>
<p><span style="color:black; font-family:宋体; font-size:10pt">create proxy_table xmlxfsTab external directory at &quot;/dev/shm;R&quot; </span></p>
<p><span style="color:black; font-family:宋体; font-size:10pt">查看目录/dev/shm下文件： </span></p>
<p><span style="color:black; font-family:宋体; font-size:10pt">select filename,size,filetype from xmlxfsTab </span></p>
<p><span style="color:black; font-family:宋体; font-size:10pt">下面SQL语句返回：testdb..sysobjects.xml文档中id&lt;10或者name=&quot;sysroles&quot;的记录集： </span></p>
<p><span style="color:black; font-family:宋体; font-size:10pt">set textsize 100000000 </span></p>
<p><span style="color:blue; font-family:宋体; font-size:10pt">select filename ,xmlextract(&#39;//resultset/row[id&lt;10 or name=&quot;sysroles&quot;]&#39;,content) from xmlxfsTab where filename=&#39;testdb..sysobjects.xml&#39; </span></p>
<p><span style="color:black; font-family:宋体; font-size:10pt">下面SQL语句返回：testdb..sysobjects.xml文档中id&lt;10或者name=&quot;sysroles&quot;的表名列表： </span></p>
<p><span style="color:black; font-family:宋体; font-size:10pt">set textsize 100000000 </span></p>
<p><span style="color:blue; font-family:宋体; font-size:10pt">select filename ,xmlextract(&#39;//resultset/row[id&lt;10 or name=&quot;sysroles&quot;]/name&#39;,content) from xmlxfsTab where filename=&#39;testdb..sysobjects.xml&#39; </span></p>
<p><span style="color:black; font-family:宋体; font-size:10pt">在执行xmlextract函数时，如果xml文档大小过大，会报堆内存不足的错误。 </span></p>
<p><a href="https://www.dbainfo.net/wp-content/uploads/2013/10/101513_0159_ASExml2.jpg" class="highslide-image" onclick="return hs.expand(this);" onclick="window.open(this.href, '', 'resizable=no,status=no,location=no,toolbar=no,menubar=no,fullscreen=no,scrollbars=no,dependent=no'); return false;"><img alt="" src="https://www.dbainfo.net/wp-content/uploads/2013/10/101513_0159_ASExml2.jpg" /><span style="color:black; font-family:宋体; font-size:10pt"> </span></a></p>
<p><span style="color:black; font-family:宋体; font-size:10pt">建议根据提示增加参数:heap memory per user。sp_configure &quot;heap memory per user&quot;,NNNNNNN </span></p>
<p><span style="color:black; font-family:宋体; font-size:10pt">另外，也可以用java,SAX,DOM,JDOM等工具来解析xml文档。 </span></p>
<p><span style="color:red; font-family:宋体; font-size:16pt">三、函数xmltable的用法 </span></p>
<p><span style="color:black; font-family:宋体; font-size:10pt">函数xmltable能根据xml内容返回一个SQL表。对xmltable()的单个调用可取代在每次迭代时对xmlextract进行多次调用的T-SQL循环；调用xmltable()相当于对由xmltable()生成的表的每行执行单个xmlextract表达式。 </span></p>
<p><span style="color:black; font-family:宋体; font-size:10pt">例子： </span></p>
<p><span style="color:blue; font-family:宋体; font-size:10pt">declare @a text </span></p>
<p><span style="color:blue; font-family:宋体; font-size:10pt">select @a=(select id,name,type,crdate,sysstat from sysobjects for xml) </span></p>
<p><span style="color:blue; font-family:宋体; font-size:10pt">select @a </span></p>
<p><span style="color:blue; font-family:宋体; font-size:10pt">select * from xmltable(&#39;/resultset/row&#39; passing @a columns id int , name varchar(255)) as xml_table </span></p>
<p><span style="color:blue; font-family:宋体; font-size:10pt">go </span></p>
<p><span style="color:black; font-family:宋体; font-size:10pt">对于包含id,name,type,crdate,sysstat列的xml形式数据，xmltable能够生成包含id、name两列的SQL表。 </span></p>
<div style="clear: both; margin: 10px 0pt; border: 1px dashed rgb(153, 153, 153); font-size: 12px; padding: 5px 10px;">
<li>本文链接地址：<a href="https://www.dbainfo.net/ase-xml-introduction.htm">https://www.dbainfo.net/ase-xml-introduction.htm</a>；</li>
<li>本文为dbainfo个人原创，请在尊重作者劳动成果的前提下进行转载；</li>
<li>转载务必注明原始出处 : <a href="https://www.dbainfo.net/">Sybase数据库技术，数据库恢复专家</a>；</li>
<li>对《<a href="https://www.dbainfo.net/ase-xml-introduction.htm">ASE中xml服务使用方法简介</a>》有何疑问或见解，请在本文下方发表；</li>
<li>对网站还有其他问题或建议，请提交在<a href="https://www.dbainfo.net/messages" target="_blank">留言板</a>，谢谢！</li>
</div>
<h2  class="related_post_title">相关文章</h2><ul class="related_post"><li>2013-09-16 -- <a href="https://www.dbainfo.net/select-random-rows-from-table.htm" title="ASE从表中随机选择数据的三种方法">ASE从表中随机选择数据的三种方法</a> (0)</li><li>2013-09-08 -- <a href="https://www.dbainfo.net/get-current-running-sql.htm" title="查看ASE v15正在执行的SQL语句内容">查看ASE v15正在执行的SQL语句内容</a> (0)</li><li>2013-11-19 -- <a href="https://www.dbainfo.net/showplan_html_format.htm" title="以HTML格式显示ASE查询计划">以HTML格式显示ASE查询计划</a> (0)</li><li>2012-11-14 -- <a href="https://www.dbainfo.net/sybase-ase-job-scheduler-schedule-jobs.htm" title="在Sybase ASE上利用job scheduler定时调度作业">在Sybase ASE上利用job scheduler定时调度作业</a> (7)</li><li>2015-01-16 -- <a href="https://www.dbainfo.net/one-way-to-recover-master-configuration-area.htm" title="master数据库配置区域(configuration area)损坏的一种修复方法">master数据库配置区域(configuration area)损坏的一种修复方法</a> (1)</li><li>2014-10-10 -- <a href="https://www.dbainfo.net/ase-object-name-length-limit.htm" title="ASE对象名称长度限制">ASE对象名称长度限制</a> (0)</li><li>2014-06-09 -- <a href="https://www.dbainfo.net/count_all_tables_rowcount.htm" title="统计用户数据库内所有表的行数">统计用户数据库内所有表的行数</a> (0)</li><li>2013-11-11 -- <a href="https://www.dbainfo.net/ase-15-0-3-for-windows-installation5.htm" title="Sybase ASE 15.0.3 for windows平台安装文档 – 5、安装后的配置工作">Sybase ASE 15.0.3 for windows平台安装文档 – 5、安装后的配置工作</a> (1)</li><li>2013-11-11 -- <a href="https://www.dbainfo.net/ase-15-0-3-for-windows-installation4.htm" title="Sybase ASE 15.0.3 for windows平台安装文档 – 4、安装Sybase数据库服务">Sybase ASE 15.0.3 for windows平台安装文档 – 4、安装Sybase数据库服务</a> (0)</li><li>2013-11-11 -- <a href="https://www.dbainfo.net/ase-15-0-3-for-windows-installation3.htm" title="Sybase ASE 15.0.3 for windows平台安装文档 – 3、升级到 Sybase 15.0.3 ESD #3">Sybase ASE 15.0.3 for windows平台安装文档 – 3、升级到 Sybase 15.0.3 ESD #3</a> (0)</li></ul>]]></content:encoded>
			<wfw:commentRss>https://www.dbainfo.net/ase-xml-introduction.htm/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
