Difficulty: Easy
Correct Answer: Place the values of the columns as attributes in each XML row element.
Explanation:
Introduction / Context:SQL Server supports several FOR XML modes (RAW, AUTO, PATH) to serialize result sets into XML. Understanding their output shape is important for integration and APIs.
Given Data / Assumptions:
Concept / Approach:FOR XML RAW returns each row as a generic element (often
Step-by-Step Solution:
Recall RAW mode: one element per row; columns as attributes.Match this to the choices provided.Select option (a).Verification / Alternative check:Run a simple query like SELECT 1 AS A, 'X' AS B FOR XML RAW; the output resembles
Why Other Options Are Wrong:
Common Pitfalls:Assuming RAW provides nested hierarchies; RAW is flat and generic unless combined with additional directives.
Final Answer:Place the values of the columns as attributes in each XML row element.
Discussion & Comments