Chapter 7: Querying and Managing XML Data Flashcards

1
Q

What’s the difference between attributes - centric and element - centric?

A

The former: , and the latter:

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

Which clause I need to use for convert a query result to a XML?

A

FOR XML clause.

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

What’s the difference between FOR XML RAW and FOR XML AUTO?

A

Using the RAW version, retrieves a XML without formatting, whereas AUTO version formats by using heuristics.

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

How I can generate a XML from a result set?

A

Just by adding the clause FOR XML {RAW | AUTO | EXPLICIT | PATH} at the bottom of the query.

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

When using FOR XML AUTO, how the XML looks like?

A

Each row will be mapped as an node, and the columns will be mapped as node’s attributes (not elements; the elements are those node’s children). In case the column is a XML data type, then it’ll be treated as a node child.

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

How I can create a XML that his children are elements, not attributes?

A

By using the subclause ELEMENTS after using FOR XML AUTO. For example: FOR XML AUTO, ELEMENTS.

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

Can I combine node’s attributes with node’s elements?

A

Yes, it’s possible. Instead of using FOR XML AUTO, use FOR XML PATH, and ensure to alias the column with “@” symbol. For example: OrderId AS ‘@OrderId’

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