Unit 8 Flashcards
Consider the following code:
16
XML Validation: XML instance must be a document.
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
Which method would you use to split the nodes of the current xml data type into rows?
nodes()
What is used to structure the data in an XML document?
XML Tags
Code a statement that defines a variable named @EventData that can hold XML data
DECLARE @EventData xml;
What is the name of the language that’s designed to query an XML document?
XQUERY
The highest-level element in an XML document is called the what?
root element
An element that is contained within another element is called what?
child element
Which statement do you use to add an XML Schema Definition to a database?
CREATE XML SCHEMA COLLECTION
Consider the following code:
16
XML Validation: XML instance must be a document.
Which of the following statements could you use to determine if the @ErrorData variable contains the ErrorMessage element? Assume that the @ErrorData variable is declared with the xml data type and that it contains the XML data shown in the example.
IF @ErrorData.exist(‘/Error/ErrorMessage’) = 1
When you use the Query Editor to run a query that returns an xml type, the Management Studio displays the XML data in blue with underlining to indicate that it is what?
a link
You can code one or more ________________ within the start tag of an element.
attributes
If you want to make sure that the data you attempt to store in the xml data type is valid, you can
specify an XSD for the xml data type when you define a column or variable
Which of the following defines a table column named ErrorData that can contain XML data and that will be validated using an XML schema named ErrorDataSchema? Assume that the column can’t contain null values.
ErrorData xml (ErrorDataSchema) NOT NULL
What can you call an element that contains other elements?
parent element
What can you use to convert XML data into relational data?
OPENXML statement