Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 634703
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T20:19:28+00:00 2026-05-13T20:19:28+00:00

Apologies if this is answered elsewhere. I keep getting the error message XQuery [Mytable.XMLData.nodes()]:

  • 0

Apologies if this is answered elsewhere. I keep getting the error message
XQuery [Mytable.XMLData.nodes()]: There is no element named ‘Answer’

SELECT 
ref.value('/','nvarchar(1000)')
FROM   Mytable CROSS APPLY xmldata.nodes('Answer') R(ref)

–

--XML of Row
<Answer xmlns="http://TempNameSpace.com/AnswerData.xsd" Type="Deliverable">
  <Deliverable>
    <Title>test</Title>
    <Description>test</Description>
    <DueDate>2010-02-16T08:59:59</DueDate>
  </Deliverable>
</Answer>

I’ve tried several different variations on getting the root node (‘answer’), or any of the child nodes
if, however i change my statement to read

SELECT 
ref.value('/','nvarchar(1000)')
FROM   Mytable CROSS APPLY xmldata.nodes('/') R(ref)

i get the result
testtest2010-02-16T08:59:59

I’d ultimately like this data in tabular format, something like

SELECT 
    ref.value('/Title','nvarchar(1000)') as Title
    ref.value('/Description','nvarchar(1000)') as Description

etc..
    FROM   Mytable CROSS APPLY xmldata.nodes('/Deliverable') R(ref)

Thanks for your help

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T20:19:29+00:00Added an answer on May 13, 2026 at 8:19 pm

    You’re not paying attention to the XML namespace in play:

    <Answer xmlns="http://TempNameSpace.com/AnswerData.xsd" Type="Deliverable" 
            **********************************************
    

    You need to take that into account when querying – do something like this:

    ;WITH XMLNAMESPACES('http://TempNameSpace.com/AnswerData.xsd' AS ns)
    SELECT 
      ref.value('(ns:*)[1]', 'nvarchar(1000)')
    FROM Mytable 
    CROSS APPLY xmldata.nodes('/ns:Answer') R(ref)
    

    You need to reference everything inside <Answer> with the ns: XML namespace prefix.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Apologies if this was answered elsewhere -- I did some searching and couldn't find
Apologies if this has been answered already. There are similar topics but none that
I am just getting started with IoC containers so apologies if this is a
Apologies if this has been answered before. I've been trying to construct an XPath
My apologies if this has been answered before or is obvious...did some searching here
Apologies if this has already been answered many times, but I was unable to
OK, Apologies if this has already been asked and/or Answered but I'm struggling to
Apologies if this question is a bit daft, but are there any negative repercussions
Apologies if this has been answered before or if it's too obvious - pointers
I've tried searching but haven't had much luck- apologies if this is answered somewhere.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.