J'ai une procédure stockée qui reçoit du XML comme ceci:Comment obtenir une balise d'élément dans SQL Server
<Root>
<pickh attribute1="897" attribute2="GGG" ....>
<pickd attribute1="123" attribute2="678" ..../>
</pickh>
</Root>
ou
<Root>
<rcpth attribute1="ABC" attribute2 ="DEF" ....>
<rcptd attribute1="012" attribute2="345" ..../>
</rcpth>
</Root>
ce que je dois faire quelque chose comme:
select Nodetype = (here is the part that I need help),
Attribute1 = nodes.c.value('@Attribute1','varchar(40)'),
Attribute2 = nodes.c.value('@Attribute2','varchar(40)')
from @Xml.nodes('/Root//*') as node(c)
Cette requête doit renvoyer comme résultat ceci:
NodeType Attribute1 Attribute2
pickh 897 GGG
pickd 123 678
rcpth ABC DEF
rpctd 012 345
Existe-t-il un moyen de le faire?