Re: FOR XML AUTO, ELEMENTS

Tech-Archive recommends: Fix windows errors by optimizing your registry



NB: I'm assuming you're using SQL Server 2000 - in SQL Server 2005 you could
use PATH mode.

--
Graeme Malcolm
Principal Technologist
Content Master
- a member of CM Group Ltd.
www.contentmaster.com


"Graeme Malcolm" <graemem_cm@xxxxxxxxxxx> wrote in message
news:O81hWwRiFHA.3544@xxxxxxxxxxxxxxxxxxxxxxx
Actually, RAW (in SQL Server 2000) will return everything as attributes, and
as I understand it you want a mix of attributes and elements. To do that
you'd need to use EXPLICIT mode, as in this example:

USE Northwind

SELECT 1 AS Tag,
NULL AS Parent,
ProductID AS [Item!1!ProductID],
ProductName AS [Item!1!Name!element],
UnitPrice AS [Item!1!Price!element]
FROM [Products]
FOR XML EXPLICIT


Cheers,
Graeme
--
Graeme Malcolm
Principal Technologist
Content Master
- a member of CM Group Ltd.
www.contentmaster.com


"ali" <ali.jan@xxxxxxxxx> wrote in message
news:1121413418.618949.238900@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
I am not an expert, but according to the docs you cannot do that with
AUTO. You will need to do it with RAW.



.



Relevant Pages

  • Re: SQLXML Managed Classes
    ... need Visual Studio. ... Graeme Malcolm ... Content Master ... - a member of CM Group Ltd. ...
    (microsoft.public.sqlserver.xml)
  • Re: Troubleshooting XML Bulk Load
    ... Graeme Malcolm ... >> Graeme Malcolm ... >> Content Master ... >> - a member of CM Group ...
    (microsoft.public.sqlserver.xml)
  • Re: Troubleshooting XML Bulk Load
    ... Graeme Malcolm ... >> Graeme Malcolm ... >> Content Master ... >> - a member of CM Group ...
    (microsoft.public.sqlserver.xml)
  • Re: wicked easy xml question?
    ... "Graeme Malcolm" wrote in message ... > FOR XML EXPLICIT ... > Content Master Ltd. ... > XML output like this through FOR XML EXPLICIT... ...
    (microsoft.public.sqlserver.xml)
  • Re: Persisting XML
    ... started by Mike UK in this newsgroup. ... Graeme Malcolm ... Content Master Ltd. ...
    (microsoft.public.sqlserver.xml)