Showing posts with label SQL Query to create xml file. Show all posts
Showing posts with label SQL Query to create xml file. Show all posts

SQL Query to create xml file from sqlserver 2008

Below Query i have use in my project to create xml file directly through SQL Server 2008 by using SQL Query table column value in CDATA

select 1    as Tag,
       null as Parent,
       AIRPORT_ITEM.
       AIRPORT_ID as [AD!1!AIRPORT_ID!CDATA],
       AIRPORT_ITEM.LEVEL1_TITLE as [AD!1!LEVEL1_TITLE!CDATA],
        AIRPORT_ITEM.XML_BLOCK as [AD!1!XML_BLOCK !CDATA],
        AIRPORT.GENDEC_FLAG as [AD!1!GENDEC_FLAG!CDATA]

    
from AIRPORT_ITEM  join AIRPORT 
 ON (AIRPORT_ITEM.AIRPORT_ID = AIRPORT.AIRPORT)
   
for xml explicit