• <small id='hSTnh'></small><noframes id='hSTnh'>

  • <tfoot id='hSTnh'></tfoot>
      <bdo id='hSTnh'></bdo><ul id='hSTnh'></ul>
    <i id='hSTnh'><tr id='hSTnh'><dt id='hSTnh'><q id='hSTnh'><span id='hSTnh'><b id='hSTnh'><form id='hSTnh'><ins id='hSTnh'></ins><ul id='hSTnh'></ul><sub id='hSTnh'></sub></form><legend id='hSTnh'></legend><bdo id='hSTnh'><pre id='hSTnh'><center id='hSTnh'></center></pre></bdo></b><th id='hSTnh'></th></span></q></dt></tr></i><div id='hSTnh'><tfoot id='hSTnh'></tfoot><dl id='hSTnh'><fieldset id='hSTnh'></fieldset></dl></div>
    1. <legend id='hSTnh'><style id='hSTnh'><dir id='hSTnh'><q id='hSTnh'></q></dir></style></legend>

      1. 从 varchar(max) 列中选择 XML

        时间:2023-06-07
          <bdo id='3YC7F'></bdo><ul id='3YC7F'></ul>

        • <legend id='3YC7F'><style id='3YC7F'><dir id='3YC7F'><q id='3YC7F'></q></dir></style></legend>
          <i id='3YC7F'><tr id='3YC7F'><dt id='3YC7F'><q id='3YC7F'><span id='3YC7F'><b id='3YC7F'><form id='3YC7F'><ins id='3YC7F'></ins><ul id='3YC7F'></ul><sub id='3YC7F'></sub></form><legend id='3YC7F'></legend><bdo id='3YC7F'><pre id='3YC7F'><center id='3YC7F'></center></pre></bdo></b><th id='3YC7F'></th></span></q></dt></tr></i><div id='3YC7F'><tfoot id='3YC7F'></tfoot><dl id='3YC7F'><fieldset id='3YC7F'></fieldset></dl></div>

              <tbody id='3YC7F'></tbody>

                  <small id='3YC7F'></small><noframes id='3YC7F'>

                  <tfoot id='3YC7F'></tfoot>
                  本文介绍了从 varchar(max) 列中选择 XML的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  限时送ChatGPT账号..

                  我在 SQL Server 2005 的 varchar(max) 列中存储了一些 XML 数据.数据采用以下格式(FQTN = 完全限定类型名称):

                  I have some XML data stored in a varchar(max) column on SQL Server 2005. The data is in the form (FQTN = fully qualified type name):

                  <?xml version="1.0" encoding="utf-16"?>
                  <History xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
                    <EntityViews>
                      <EntityProxy Type="FQTN" Key="386876" />
                      <EntityProxy Type="FQTN" Key="387981" />
                      <!-- etc. -->
                    </EntityViews>
                  </History>
                  

                  如何选择类型、键,以便从该列中的 XML 数据中获得单行的表格结果?该表有一个名为 HistoryId 的身份主键.

                  How can I select Type, Key so that I get a tabular result from the XML data in this column for a single row? The table has an identity primary key named HistoryId.

                  推荐答案

                  ;with cteCastToXML as (
                      select CAST(YourColumn as xml) as x
                          from YourTable
                  )
                  select h.ep.value('@Type','varchar(10)') as [Type],
                         h.ep.value('@Key', 'varchar(10)') as [Key]
                      from cteCastToXML
                          cross apply x.nodes('/History/EntityViews/EntityProxy') as h(ep)
                  

                  这篇关于从 varchar(max) 列中选择 XML的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:将两个xml片段合并为一个? 下一篇:修改 SQL server 中的 XML 以添加根节点

                  相关文章

                  最新文章

                1. <i id='QqIQx'><tr id='QqIQx'><dt id='QqIQx'><q id='QqIQx'><span id='QqIQx'><b id='QqIQx'><form id='QqIQx'><ins id='QqIQx'></ins><ul id='QqIQx'></ul><sub id='QqIQx'></sub></form><legend id='QqIQx'></legend><bdo id='QqIQx'><pre id='QqIQx'><center id='QqIQx'></center></pre></bdo></b><th id='QqIQx'></th></span></q></dt></tr></i><div id='QqIQx'><tfoot id='QqIQx'></tfoot><dl id='QqIQx'><fieldset id='QqIQx'></fieldset></dl></div>

                    <tfoot id='QqIQx'></tfoot>

                      <small id='QqIQx'></small><noframes id='QqIQx'>

                    1. <legend id='QqIQx'><style id='QqIQx'><dir id='QqIQx'><q id='QqIQx'></q></dir></style></legend>
                        <bdo id='QqIQx'></bdo><ul id='QqIQx'></ul>