日期:2014-05-17 浏览次数:20584 次
declare @x xml
select @x='
<column>
<LName ChineseName="name1" ShowOrder="0" />
<MRNADT ChineseName="name2" ShowOrder="1" />
<Gender ChineseName="name3" ShowOrder="2" />
</column>'
select c.value('local-name(.)','varchar(10)') '节点',
c.value('@ChineseName','varchar(10)') 'ChineseName',
c.value('@ShowOrder','varchar(10)') 'ShowOrder'
from @x.nodes('/column/*') as t(c)
/*
节点 ChineseName ShowOrder
---------- ----------- ----------
LName name1 0
MRNADT name2 1
Gender name3 2
(3 row(s) affected)
*/