1. Which method would you use to parse an xml data type that has been stored in
ID: 3715256 • Letter: 1
Question
1. Which method would you use to parse an xml data type that has been stored in a database into multiple columns?
a. value
b. nodes
c. modify
d. query
2.
Code example 18-1
<Error ErrorNumber = 6901>
<ErrorSeverity>16</ErrorNumber>
<ErrorMessage>XML Validation: XML instance must be a document.</ErrorMessage>
</Error>
(Refer to code example 18-1.) Which of the following SELECT clauses could you use to retrieve the value of the ErrorNumber attribute? Assume that the XML document in the example is stored in a column named ErrorData.
SELECT ErrorData.value('(Error/@ErrorNumber)[1]', 'int') AS ErrorNumber
SELECT ErrorData.value('(Error/ErrorNumber)[1]', 'int') AS ErrorNumber
SELECT ErrorData.value('(Error/ErrorNumber)', 'int') AS ErrorNumber
SELECT ErrorData.value('(Error/@ErrorNumber)', 'int') AS ErrorNumber
3. What can you use to convert relational data that’s stored in a database to XML?
FORXML statement
FOR XML clause of the SELECT statement
OPEN XML clause of the SELECT statement
OPENXML statement
4.The highest-level element in an XML document is called the what?
child element
super element
parent element
root element
a.SELECT ErrorData.value('(Error/@ErrorNumber)[1]', 'int') AS ErrorNumber
b.SELECT ErrorData.value('(Error/ErrorNumber)[1]', 'int') AS ErrorNumber
c.SELECT ErrorData.value('(Error/ErrorNumber)', 'int') AS ErrorNumber
d.SELECT ErrorData.value('(Error/@ErrorNumber)', 'int') AS ErrorNumber
Explanation / Answer
1.) d.query
to parse xml data type from database sql query is used
2)d.SELECT ErrorData.value('(Error/@ErrorNumber)', 'int') AS ErrorNumber
3)a.FORXML statement
->this return data as XML from relational database
4)d.root element
root is the highest element
//for any clarification, please do comments
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.