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. mvc 4 ActionFilterAttribute 特性,进行权限验证

    权限验证: /// <summary> /// 管理员身份验证 /// </summary> public class BasicAuthenticationAttribute ...

  2. asp.net 将word文档进行编辑并导出一个新的word

    最近做项目,需要多word文档进行编辑并导出一个新的word,在最初的word编辑中留下特定的字符串用来替换,然后在本地生成一个新的word文档,并且不修改服务器中的word文档,这样才能保证服务器中 ...

  3. 有向图强连通分量的Tarjan算法

    有向图强连通分量的Tarjan算法 [有向图强连通分量] 在有向图G中,如果两个顶点间至少存在一条路径,称两个顶点强连通(strongly connected).如果有向图G的每两个顶点都强连通,称G ...

  4. C#中指针的用法

    (*) unsafe 和 fixed unsafe { ]; ; i < array.Length; i++) { array[i] = i; } fixed (int* p = array) ...

  5. [[UIScreen mainScreen] bounds]获取尺寸不对

    http://www.cocoachina.com/bbs/read.php?tid-264373.html [[UIScreen mainScreen] bounds]获取尺寸不对       我在 ...

  6. Linux CPAN Perl 模块安装

    当我们想使用某些Perl模块的时候,很可能会遇到当前系统不存在这个模块的情况,这时我们可以通过使用CPAN来对相应的模块进行获取,下面就介绍一下CPAN的使用方法.首先,我们可以用perl -e 'u ...

  7. ASP.NET MVC分页组件MvcPager 2.0版发布暨网站全新改版

    MvcPager分页控件是在ASP.NET MVC Web应用程序中实现分页功能的一系列扩展方法,该分页控件的最初的实现方法借鉴了网上流行的部分源代码, 尤其是ScottGu的PagedList< ...

  8. Codeforces Round #379 (Div. 2) Analyses By Team:Red & Black

    A.Anton and Danik Problems: 给你长度为N的,只含'A','D'的序列,统计并输出何者出现的较多,相同为"Friendship" Analysis: lu ...

  9. PhpStorm破解教程

    http://www.cnblogs.com/buyucoder/p/5291771.html

  10. Ajax参数详解

    1.url: 要求为String类型的参数,(默认为当前页地址)发送请求的地址. 2.type: 要求为String类型的参数,请求方式(post或get)默认为get.注意其他http请求方法,例如 ...