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
相关文档:
■ 开发前要求配置
■ Select XML格式数据
■ Insert XML格式数据
■ Updata XML格式数据
■ Delete XML格式数据
开发前要求配置
必须安装Oracle客户端
把Classpath指向
classes111.zip ......
精短高效的XML解析器,纯C单一程序,应用于银行的国税库行横向联网接口系统中,稳定可靠,运行速度飞快,非相应的JAVA程序可比.以下为大部分源码:
/* Copyright (c) 2005 wzs */
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <time.h>
#include <varargs.h>
#i ......
//pugxml.h
///////////////////////////////////////////////////////////////////////////////
//
// Pug XML Parser - Version 1.0002
// --------------------------------------------------------
// Copyright (C) 2003, by Kristen Wegner (kristen@tima.net)
// Released into the Public Domain. Use at yo ......
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. ......