使用SQL操作XML简单示例
declare @xml xml
set @xml = '<root/>'
select @xml
declare @value varchar(10)
set @value = 'val1'
set @xml.modify('insert <item value="{sql:variable("@value")}" /> into (/root)[1]')
select @xml
set @value = 'val2'
set @xml.modify('replace value of (/root/item/@value)[1] with "val2"')
select @xml
set @value = 'val3'
set @xml.modify('replace value of (/root/item/@value)[1] with sql:variable("@value")')
select @xml
相关文档:
红色字体为主要代码
jsp页面中
<script language="javascript">
function updateDB(operate){
var objDom=new ActiveXObject("msxml.DomDocument");
var objRoot=objDom.createElement("All");
objDom.appendChild(objRoot);
var k=document.ge ......
set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
go
create procedure [dbo].[MachiningPayedGetListByCondition]
@CustomerName varchar(50),
@CustomerPhone varchar(50),
@PactNumber varchar(50),
@Ispay bit
as
begin
set nocount on;
SELECT
dp.ID as 'MachiningPayed/@ID',
&nbs ......
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sqlMapConfig PUBLIC "-//iBATIS.com//DTD SQL Map Config 2.0//EN"
"http://www.ibatis.com/dtd/sql-map-config-2.dtd">
<sqlMapConfig>
<!-- 配置和优化SQL Map解析实例的设定 -->
<settings cacheModelsEnabled=" ......