declare @xml xml
 declare @propertyName varchar(50)
 declare @str nvarchar(max)
   set @propertyName = 's_Code'
   set @xml = '<root> <row propertyName="s_Code">test</row><row propertyName="s_Posword">admin</row></root>'
  
   SELECT @str =@xml.value('(/root/row[@propertyName=sql:variable("@propertyName")])[1]', 'nvarchar(max)')
   select @str
  
  
 declare @xml xml
 declare @propertyName varchar(50)
 declare @str nvarchar(max)
   set @propertyName = 's_Posword'
   set @xml = '<root> <row propertyName="s_Code">test</row><row propertyName="s_Posword">admin</row></root>'  
   SELECT @str =@xml.value('(/root/row[@propertyName=sql:variable("@propertyName")])[1]', 'nvarchar(max)')
   select @str

sqlserver 读取xml 字符串方法的更多相关文章

  1. java解析xml字符串方法

    一,用DOM4J  针对无重复标签的xml字符串格式,如下: 针对此种情况可用DOM4J解析法,引入 dom4j的相关jar包代码如下: Document document=DocumentHelpe ...

  2. Java获取路径方法&相对路径读取xml文件方法

    (1).request.getRealPath("/");//不推荐使用获取工程的根路径 (2).request.getRealPath(request.getRequestURI ...

  3. javascript读取xml的方法【转载】

    jquery读取xml文件 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http ...

  4. Java笔记之Scanner先读取一个数字,在读取一行字符串方法分析

    问题:大家在学习Java读取数据的时候一般都是使用Scanner方法读取数据,但是其中有一个小问题大家可能不知道, 就是我们在使用scanner的时候如果你先读取一个数字,在读取一行带有空格的字符串, ...

  5. asp.net写入读取xml的方法

    添加命名空间 using System.Xml; 我自己的代码(添加其中的节点) XmlDocument xmlDoc = new XmlDocument();xmlDoc.Load(Server.M ...

  6. sax xpath读取xml字符串

    public static void main(String[] args) throws ParserConfigurationException, SAXException, IOExceptio ...

  7. dom4j处理xml文件,读取xml字符串,格式化xml文件

    1.xml文件 <?xml version="1.0" encoding="UTF-8"?> <employees> <emplo ...

  8. 最简单的JAVA解析XML字符串方法

    引入 dom4j 包<dependency> <groupId>dom4j</groupId> <artifactId>dom4j</artifa ...

  9. 读取XML字符串到临时表

    DECLARE @hdoc int DECLARE @doc xml SET @doc = '<CityValueSet> <CityItem> <CityId>2 ...

随机推荐

  1. Arcengine,C#获得FeatureClass的坐标系ISpatialReference以及所在数据集名称

    1: /// <summary> 2: /// 获得坐标系统 3: /// </summary> 4: /// <param name="pFeatureCla ...

  2. HashMap学习

    HashMap<String, Object> java.util.HashMap<String, Object>   在数组中我们是通过数组下标来对其内容索引的,而在Map中 ...

  3. css实现并列效果

    <a href="#" class="mj-picList"> <div class="mj-picList-pic" s ...

  4. mysql备份文件注释乱码处理工具

    我们有时候需要做mysql数据库的注释,可是备份出来的是乱码,怎么办呢? 本工具软件来帮你的忙. 将GBK库备份后的文本文件中夹带的UTF8乱码转换为GBK编码,就不再乱码了. http://down ...

  5. OpenSSL Heartbleed原因小结

    User发送心跳报文给Server,Server复制心跳报文的内容回应User. memcpy(bp, p1, payload); Server拷贝心跳报文的内容给Client时,如果拷贝的字节数目超 ...

  6. 188. Best Time to Buy and Sell Stock IV leetcode解题笔记

    Say you have an array for which the ith element is the price of a given stock on day i. Design an al ...

  7. Thinkphp去掉index.php

    1.httpd.conf配置文件中 #LoadModule rewrite_module modules/mod_rewrite.so 把前面的警号去掉2.AllowOverride None 将No ...

  8. IOS调用WCF服务,WCF服务器进行上传图片

    1.IOS端采用post方式请求服务器端的url地址 如:http://192.168.0.12:50000/serverce1.svc/upload IOS端的代码采用base64位编码的方式传值给 ...

  9. js弹出公告

    调用: $(document).ready(function(){ sAlert("公告","内容"); }); 方法 function sAlert(strT ...

  10. swift基础语法(四) 函数、闭包(Closures)

    //函数基本定义 func 函数名(参数名:参数类型=默认值) ->返回值类型{代码块} //无参无返回值函数 func hsmin(){ } //单参无返回值函数 func prin(st:S ...