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>

  • 相关阅读:
    数据结构-树与二叉树-思维导图
    The last packet successfully received from the server was 2,272 milliseconds ago. The last packet sent successfully to the server was 2,258 milliseconds ago.
    idea连接mysql报错Server returns invalid timezone. Go to 'Advanced' tab and set 'serverTimezone' property
    redis学习笔记
    AJAX校验注册用户名是否存在
    AJAX学习笔记
    JSON学习笔记
    JQuery基础知识学习笔记
    Filter、Listener学习笔记
    三层架构学习笔记
  • 原文地址:https://www.cnblogs.com/chuhaida/p/4586200.html
Copyright © 2011-2022 走看看