zoukankan      html  css  js  c++  java
  • sql xml 查询指定节点值,以及节点属性值

    SELECT   top 10  [HFMBDATA].query('(/Items/Item[@ID=''tbBryj''])').value('(//TextValue)[1]','nvarchar(max)') as mz,

    [HFMBDATA].value('(Items/Item[@ID="rb_fzhd_y"]/@ControlType)[1]','varchar(50)')   FROM [EMRCP].[dbo].[T_ZYBR_HF] as at

    获取结果:

    mz        at
    无         CheckBox.RadioBox

     

    示例XML(HFMBDATA)

    <Items>
      <Item ID="rb_cyhhjzk_h" Name="cyhhjzk" ControlType="CheckBox.RadioBox" Value="" Checked="True">
        <TextValue>好</TextValue>
      </Item>
      <Item ID="rb_cyhhjzk_yb" Name="cyhhjzk" ControlType="CheckBox.RadioBox" Value="" Checked="False">
        <TextValue>一般</TextValue>
      </Item>
      <Item ID="rb_cyhhjzk_bh" Name="cyhhjzk" ControlType="CheckBox.RadioBox" Value="" Checked="False">
        <TextValue>不好</TextValue>
      </Item>
      <Item ID="rb_sy_h" Name="sy" ControlType="CheckBox.RadioBox" Value="" Checked="True">
        <TextValue>好</TextValue>
      </Item>
      <Item ID="rb_sy_yb" Name="sy" ControlType="CheckBox.RadioBox" Value="" Checked="False">
        <TextValue>一般</TextValue>
      </Item>
      <Item ID="rb_sy_bh" Name="sy" ControlType="CheckBox.RadioBox" Value="" Checked="False">
        <TextValue>不好</TextValue>
      </Item>
      <Item ID="rb_asfy_y" Name="asfy" ControlType="CheckBox.RadioBox" Value="" Checked="False">
        <TextValue>有</TextValue>
      </Item>
      <Item ID="rb_asfy_my" Name="asfy" ControlType="CheckBox.RadioBox" Value="" Checked="False">
        <TextValue>没有</TextValue>
      </Item>
      <Item ID="rb_cxzz_y" Name="cxzz" ControlType="CheckBox.RadioBox" Value="" Checked="False">
        <TextValue>有</TextValue>
      </Item>
      <Item ID="rb_cxzz_my" Name="cxzz" ControlType="CheckBox.RadioBox" Value="" Checked="False">
        <TextValue>没有</TextValue>
      </Item>
      <Item ID="tbBryj" Name="" ControlType="InputField.Text" Value="">
        <TextValue>无</TextValue>
        <Items />
      </Item>
      <Item ID="tb_hfryyj" Name="" ControlType="InputField.Text" Value="">
        <TextValue>无</TextValue>
        <Items />
      </Item>
      <Item ID="tb_yshfyj" Name="" ControlType="InputField.Text" Value="">
        <TextValue>无</TextValue>
        <Items />
      </Item>
    </Items>

  • 相关阅读:
    jsp%不能解析
    hibernate映射数据库时@ManyToOne和@OneToMany
    PSP需求分析文档
    医院挂号系统前景与范围文档
    PSP个人软件开发工具需求分析文档
    英雄联盟战队管理系统项目前景与范围文档
    在学习抛出异常的过程中,关于错误信息 TypeError: exceptions must derive from BaseException 的原因
    python面向对象__slots__变量的运用
    初学过程中,对于python if__name__=='main'的作用
    使用C模拟面向对象实现如java的LinkedList集合(好精彩)
  • 原文地址:https://www.cnblogs.com/chuhaida/p/4586200.html
Copyright © 2011-2022 走看看