I got this in a XML field in sql server 2005
<Details>
  <Attribute Type="org">6800</Attribute>
  <Attribute Type="fac">100</Attribute>
  <Attribute Type="fac">200</Attribute>
</Details>
what would be 开发者_如何学编程the syntax to transform this into a table, like this
 col_Type col_value
    org      6800
    fac      100
    fac      200
I'm currently stuck with singleton error while writing my query
found how to do it
if someone want to know how:
    declare @XmlContent xml
    set @XmlContent = '<Details>
      <Attribute Type="org">6800</Attribute>
      <Attribute Type="fac">100</Attribute>
      <Attribute Type="fac">200</Attribute>
    </Details>'
    SELECT
             Details.Attribute.value('(@Type)[1]', 'varchar(10)') AS 'Type',
             Details.Attribute.value('(.)[1]', 'int') AS 'Value'
          FROM
             @XmlContent.nodes('/Details/Attribute') AS Details(Attribute)
 
         
                                         
                                         
                                         
                                        ![Interactive visualization of a graph in python [closed]](https://www.devze.com/res/2023/04-10/09/92d32fe8c0d22fb96bd6f6e8b7d1f457.gif) 
                                         
                                         
                                         
                                         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论