Check out the local-name function of XQuery - see MSDN docs here .
Given a set of node or node, it should give you the name node - the name of the tag. I assume you are looking, right?
eg. if you do this:
DECLARE @input XML = '<record> <field name="f1"/> <id name="f2"/> <id name="f3"/> <field name="f4"/> <info/> </record>' SELECT inp.nod.query('local-name(.)') FROM @input.nodes('//*') AS inp(nod)
You will get the following output:
record field id id field info
source share