Can you get a xml declartion with for xml explicit output

Last Post 19 Aug 2008 12:06 PM by rstojkovic. 0 Replies.
AddThis - Bookmarking and Sharing Button
Author Messages
rstojkovic
New Member
New Member

--
19 Aug 2008 12:06 PM
I have my sql genereating a xml using the FOR XML EXPLICIT functionality. What I am missing is the xml version declaration as the first row in the xml file. Can you have that row created when running the sql to extract the data from the database.

Below is my sql

SELECT 1 AS TAG,
NULL AS PARENT,
[UserData].[nvarchar1] AS 'course!1!name!ELEMENT',
[UserData].[ntext2] AS 'course!1!description!CDATA',
[UserData].[nvarchar4] AS 'course!1!linklabel!ELEMENT',
('_downloads/functional/'+ [UserData].[nvarchar2]) AS 'course!1!link!ELEMENT'
FROM
[dbo].[Lists] [Lists],[dbo].[UserData] [UserData]
WHERE
([Lists].[tp_ID]=[UserData].[tp_ListId])
AND
([Lists].[tp_ID] ='{45461172-032A-4313-9E30-87DC0025884D}')
AND [UserData].[bit2] = 1

order by [UserData].[float1]
FOR XML EXPLICIT,ROOT('coursemenu')

Thanks for any help.


Acceptable Use Policy
---