Geeks With Blogs
Shailen Sukul blog September 2006 Entries
How to use FOR XML to return an Xml Document with a root element
The query below shows how to create an XML document using FOR XML from a table (based on Sql Server 2000). To start with, run the sql script further below to create the sample table, and populate it with some data. Once the select script is run, data will be returned in the form: <Employees> <Employee> <field1></field1> ... </Employee> </Employees> Query select 1 as Tag, NULL as Parent, NULL as [Employees!1!Employee!xml], NULL as [Employee!2!OfficerId!xml], NULL ......

Posted On Thursday, September 7, 2006 11:20 AM

Copyright © Shailen Sukul | Powered by: GeeksWithBlogs.net