[英]Find XML Elements Name in SQL
I have this XML file: 我有这个XML文件:
<D>
<RecordChanged TriggeringTable="Table1" />
<Demographics Patient_x0020_Number="12984" ChartNo="0"/>
<Appt ApptID="38155" MDID="54" ApptStart="2013-10-23T13:20:00" PatientID="12988"/>
<Billing BillingID="37713" ApptID="38035" PatientID="12772"/>
</D>
Now, I want to know the name of each element. 现在,我想知道每个元素的名称。 So, my answer should be: 所以,我的答案应该是:
RecordChanged ,
Demographics ,
Appt ,
Billing
How can I write the query in SQL Server? 如何在SQL Server中编写查询?
TNX. TNX。
select
T.C.value('local-name(.)', 'nvarchar(max)') as Name
from @xml.nodes('D/*') as T(C)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.