易截截图软件、单文件、免安装、纯绿色、仅160KB

Sql Server 对xml类型的操作

 declare @XML XML
SET @XML='<root>
 <OLDVALUE>
  <H_Action id="1130">030</H_Action>
  <D_Action>030</D_Action>
  <OrderCompany>00220</OrderCompany>
  <OrderNumber>10004035</OrderNumber>
  <OrderType>SO</OrderType>
  <LineNumber>10.100</LineNumber>
 </OLDVALUE>
 <NEWVALUE>
  <H_Action>040</H_Action>
  <D_Action>040</D_Action>
  <OrderCompany>00220</OrderCompany>
  <OrderNumber>10004035</OrderNumber>
  <OrderType>SO</OrderType>
  <LineNumber>10.100</LineNumber>
  <LineType>CS</LineType>
  <LoadNumber>8811</LoadNumber>
 </NEWVALUE>
</root>'
select c.value('H_Action[1]','varchar(20)') as H_Action,
c.value('D_Action[1]','varchar(20)') as D_Action,
c.value('OrderCompany[1]','varchar(20)') as OrderCompany,
c.value('OrderNumber[1]','varchar(20)') as OrderNumber,
c.value('OrderType[1]','varchar(20)') as OrderType,
c.value('LineNumber[1]','varchar(20)') as LineNumber
from @XML.nodes('//OLDVALUE') as T(C)
select c.value('H_Action[1]','varchar(20)') as H_Action,
c.value('D_Action[1]','varchar(20)') as  D_Action,
c.value('OrderCompany[1]','varchar(20)') as OrderCompany,
c.value('OrderNumber[1]','varchar(20)') as OrderNumber,
c.value('OrderType[1]','varchar(20)') as OrderType,
c.value('LineNumber[1]','varchar(20)') as LineNumber,
c.value('LineType[1]','varchar(20)') as LineType,
c.value('LoadNumber[1]','varchar(20)') as LoadNumber
from @XML.nodes('//NEWVALUE') as T(C)
CREATE TABLE [dbo].[T_XML](
 [ID] [int] NULL,
 [DOC] [xml] NULL
)
--query
select doc.query('//NEWVALUE') from t_xml
select doc.query('(root/OLDVALUE/H_Action[@id="1130"])') from t_xml
--


相关文档:

XML字符串和XML文档之间的自由转换

本文系转载,谨向转载处空间拥有者及源出处文章作者表示感谢!
转载处:http://henry19890701.javaeye.com/blog/481462
源出处:http://www.ziliaonet.com/tech/netprogramme/XML/200605/69398.html
在做一般的XML数据交换过程中,我更乐意传递XML字符串,而不是格式化的XML Document。这就涉及到XML字符串和Xml Docume ......

flash读取xml数据显示图片在火狐中不能正常显示的问题

在html文件中嵌入的代码如下:
<script type="text/javascript">
var xmlUrl="news.xml";
var swfURL="news.swf";
var img_Speed=2;
var page_Speed=3000;
var TextPosition="down";
var HeadlineColor="#ff0000";
var HeadlineFont="14px";
va ......

XML查询子节点的方法

   对Xml的节点进行简单查询的时候,常用的可以使用如下方法:
(1) XmlNode node = doc.selectSingleNode("//AllNode/Node[@ID = ’aaa’]");
在整个Xml中查找AllNode节点下的节点名为Node的节点,该子节点的ID属性值为aaa
(2)XmlNode node = doc.selectSingleNode("//AllNode /*[@ID = ’aaa& ......

SQL Server2000 解析XML

DECLARE @HDOC INT --文档句柄
DECLARE @XMLSTRING VARCHAR(200) --XML字符串
SET @xmlString ='<?xml version="1.0"?>
<ROOT>
<USER ID="1" Name="SBQCEL"/>
<USER ID="2" Name="PEACELI"/>
<USER ID="3" Name="SHEEPCHANG"/>
</ROOT>'
--使用系统存储 ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号