I have a basic question but I did not manage to find an answer. I am new here, new to SQL and new to XML so I hope this level of question is not too basic.
I have an XML empty tags but want to address them in my select in sql:
<Question, Id='Q.01', Multiselect='False'>
<Answers>
<Answer, Id='A.01.01', IsChosen='False'>
<Ansewr, Id='A.01.02', IsChosen='True'>
</Answers>
</Question>
<Question, Id='Q.02', Multiselect='False'>
<Answers>
<Answer, Id='A.02.01', IsChosen='True'>
<Ansewr, Id='A.02.02', IsChosen='False'>
</Answers>
</Question>
I would like to make a table out of it:
A.01.01 | A.01.02 | A.02.01 | A.02.02 |
False | True | True | False |
I am trying
../Questions/Question[@Id="Q.01"]/ Answers/Answer[@Id="A.01.01"]/IsChosen'). value('.','nvarchar(10)') as A.01.01
But it is giving me an error. What is correct syntax in this case?