This might be Off Topic but here goes: I have an XPATH query question regarding element names and how to retrieve them in SQL Server 2005. Specifically given this xml document or something similar:
<books> <book> <title>The Way Things Are.</title> <author>Irene R. Gibson</author> </book> <book> <title>The Way Things Were.</title> <author>Kari D. Bednarz</author> </book> </books> I want to be able to specify that I want all "title"s and all "author"s within the same query. Here's what I have so far and I can't seem to find any examples of anything dealing with elements vs. attributes: SELECT T.C.value('.[text()]', 'varchar(255)') AS NodeText FROM @xml.nodes('/books/book/*') AS T(C) Now, I realize that the text() method only produces the text. However I've not been able to find a way to query the node text based on the name of the node. Any help would be appreciated. Thanks, Mike =================================== This list is hosted by DevelopMentorĀ® http://www.develop.com View archives and manage your subscription(s) at http://discuss.develop.com