Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I recently saw this answer on SO which uses the "local-name" value while shredding xml using .nodes(). I've never seen this before:

select T.N.value('local-name(.)', 'varchar(128)') as Name,
       T.N.value('.', 'varchar(max)') as Value
from @xml.nodes('/data/*') as T(N);

Where can I find the definitive document on commands like .nodes() and .value()?

share|improve this question
up vote 3 down vote accepted

Those methods are part of the xml data type in Sql Server, starting from 2005, since the xml data type was implemented for Sql Server 2005.

The local-name method is part of XQuery implementation of Sql Server. Its far from being a complete implementation of the XQuery specification, but it can be helpful.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.