Unit 8 Flashcards

1
Q

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.

A

SELECT ErrorData.value(‘(Error/@ErrorNumber)[1]’, ‘int’) AS ErrorNumber

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Which method would you use to split the nodes of the current xml data type into rows?

A

nodes()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is used to structure the data in an XML document?

A

XML Tags

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Code a statement that defines a variable named @EventData that can hold XML data

A

DECLARE @EventData xml;

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What is the name of the language that’s designed to query an XML document?

A

XQUERY

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

The highest-level element in an XML document is called the what?

A

root element

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

An element that is contained within another element is called what?

A

child element

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Which statement do you use to add an XML Schema Definition to a database?

A

CREATE XML SCHEMA COLLECTION

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

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.

A

IF @ErrorData.exist(‘/Error/ErrorMessage’) = 1

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

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

a link

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

You can code one or more ________________ within the start tag of an element.

A

attributes

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

If you want to make sure that the data you attempt to store in the xml data type is valid, you can

A

specify an XSD for the xml data type when you define a column or variable

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

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.

A

ErrorData xml (ErrorDataSchema) NOT NULL

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What can you call an element that contains other elements?

A

parent element

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What can you use to convert XML data into relational data?

A

OPENXML statement

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What can you use to create an XML Schema Definition for an XML document?

A

XML Editor

17
Q

What can you use to convert relational data that’s stored in a database to XML?

A

FOR XML clause of the SELECT statement

18
Q

What is the name of the language that’s designed to insert, update, or delete nodes from an XML document?

A

XML DML

19
Q

An XML schema can prevent all but one of the following from being stored in a column or variable declared with the xml type. Which one?

A

a null value

20
Q

What can you call the set of rules that an XML document must follow to be valid?

A

XML schema

21
Q

Which method would you use to parse an xml data type that has been stored in a database into multiple columns?

A

value()

22
Q

A well-formed XML document can have only one of which type of element?

A

root

23
Q

Which of the following INSERT statements inserts a row into a table named ErrorLog that consists of an identity column and a column that contains XML data?

A

INSERT INTO ErrorLog VALUES(‘An error occurred’);