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

XML ,query 和 value是区分大小写 的

DECLARE @x xml
SET @x='
<root>
  <ShopAccount>
    <ActivityType>IA - PM Standing WO (for LPI report)</ActivityType>
    <ProjectNo>R</ProjectNo>
  </ShopAccount>
  <ShopAccount>
    <ActivityType>IX - PM Associated WO (for LPI report)</ActivityType>
    <ProjectNo>C</ProjectNo>
  </ShopAccount>
</root>'
SELECT
ROW_NUMBER() OVER (order by T.c.value('ActivityType[1]','nvarchar(255)')) AS ROWID,
T.c.value('ActivityType[1]','nvarchar(255)') AS ActivityType
,T.c.value('ProjectNo[1]','nvarchar(255)') AS ProjectNo
from @x.nodes('/root/ShopAccount') T(c)
SELECT
ROW_NUMBER() OVER (order by T.c.query('ActivityType').value('ActivityType[1]','nvarchar(255)')) AS ROWID,
T.c.query('ActivityType').value('ActivityType[1]','nvarchar(255)') AS ActivityType
,T.c.query('ProjectNo').value('ProjectNo[1]','nvarchar(255)') AS ProjectNo
from @x.nodes('/root/ShopAccount') T(c)
declare @idoc int,@xmlPath nvarchar(200)
exec sp_xml_preparedocument @idoc OUTPUT, @x
set @xmlPath='/root/ShopAccount'
select
 ROW_NUMBER() OVER (order by ActivityType) AS ROWID,
 ActivityType,
 ProjectNo
from OPENXML (@idoc, @xmlPath)
WITH(ActivityType nvarchar(max) 'ActivityType',
  ProjectNo NVARCHAR(20) 'ProjectNo')
exec sp_xml_removedocument @idoc


相关文档:

flex学习 flex读取xml文件

源xml文件
 <?xml version="1.0" encoding="iso-8859-1"?>
<books>
<stock>
<name>The Picasso Code</name>
<author>Dan Blue</author>
<category>Fiction</category>
<description>Cubist paintings reveal a secret society of people ......

纯C语言XML解析器

精短高效的XML解析器,纯C单一程序,应用于银行的国税库行横向联网接口系统中,稳定可靠,运行速度飞快,非相应的JAVA程序可比.以下为大部分源码:
/* Copyright (c) 2005 wzs */
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <time.h>
#include <varargs.h>
#i ......

C#读取XML文件的简单方法

一、XML只有一个Table的情况
      (1)userInfo.xml
              <?xml version="1.0" encoding="utf-8" ?>
              <UserInfo ......

.NET SQLServer2005 XML字段

//这是添加 
private void button1_Click(object sender, EventArgs e)
        {
            string s = "Persist Security Info=False;Integrated Security=SSPI;database=IIntegration;server=(local)";
 &n ......

Load/Unload XML data in DB2

If XML data in the table is less than 32K for each record, then you can directly unload the data as char. If XML data exceeds 32K for some records, then you have to unload the common data and the XML data separately. First, create a template for unloading XML into a PDS: TEMPLATE LOBFRV DSN 'AAA. ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号