Get the names of attributes from an element in a SQL XML column

后端 未结 4 704
-上瘾入骨i
-上瘾入骨i 2021-02-06 10:36

For this xml (in a SQL 2005 XML column):


 1
 
 

4条回答
  •  佛祖请我去吃肉
    2021-02-06 10:40

    Declare @xml Xml = '1'
    
    Select n.value('local-name(.)', 'varchar(max)')  from @xml.nodes('/doc/*/@*') a(n)
    

    Returns ba bb bc bd

提交回复
热议问题