Which query should you use?

You need to generate the following XML document.
<ProductExport>
<Product Price="99">Product1</Product>
<Product Price="199">Product2</Product>
<Product Price="299">Product3</Product>
<Product Price="399">Product4</Product>
</ProductExport>

Which query should you use?

You need to generate the following XML document.
<ProductExport>
<Product Price="99">Product1</Product>
<Product Price="199">Product2</Product>
<Product Price="299">Product3</Product>
<Product Price="399">Product4</Product>
</ProductExport>

Which query should you use?

A.
SELECT Price, ProductName
FROM Products AS ProductExport
FOR XML PATH(‘Product’)

B.
SELECT Price, ProductName
FROM Products
FOR XML AUTO, ROOT(‘ProductExport’)

C.
SELECT Price [@Price],
ProductName AS [*] FROM Products AS ProductExport FOR XML AUTO, ELEMENTS

D.
SELECT Price [@Price],
ProductName AS [*] FROM Products FOR XML PATH(‘Product’),ROOT(‘ProductExport’)



Leave a Reply 0

Your email address will not be published. Required fields are marked *