Re: FOR XML AUTO, ELEMENTS
- From: "Graeme Malcolm" <graemem_cm@xxxxxxxxxxx>
- Date: Fri, 15 Jul 2005 11:11:00 +0100
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.
.
- References:
- FOR XML AUTO, ELEMENTS
- From: Alex
- Re: FOR XML AUTO, ELEMENTS
- From: ali
- Re: FOR XML AUTO, ELEMENTS
- From: Graeme Malcolm
- FOR XML AUTO, ELEMENTS
- Prev by Date: Re: FOR XML AUTO, ELEMENTS
- Next by Date: Re: XML Bulk Load
- Previous by thread: Re: FOR XML AUTO, ELEMENTS
- Next by thread: Long Running OPENXML Query
- Index(es):
Relevant Pages
|