Hi folks,
Its very easy to create xml using database fields as below:
SELECT 'A' AS GrandFather
,(
SELECT 'B' AS Father
,'C' AS Mother
,(
SELECT 'E' AS Daughter
,'F' AS Son
FOR XML Path('Childs')
,Type
)
FOR XML Path('Parents')
,Type
)
FOR XML PATH('Family')
----------------------------------
SELECT f.GF AS GrandFather
,(
SELECT f.Father AS Father
,f.Mother AS Mother
,(
SELECT f.Daughter AS Daughter
,f.Son AS Son
FOR XML Path('Childs')
,Type
)
FOR XML Path('Parents')
,Type
)
FROM Family f
FOR XML PATH('Family'), Type
Cheers!!!
Its very easy to create xml using database fields as below:
SELECT 'A' AS GrandFather
,(
SELECT 'B' AS Father
,'C' AS Mother
,(
SELECT 'E' AS Daughter
,'F' AS Son
FOR XML Path('Childs')
,Type
)
FOR XML Path('Parents')
,Type
)
FOR XML PATH('Family')
----------------------------------
SELECT f.GF AS GrandFather
,(
SELECT f.Father AS Father
,f.Mother AS Mother
,(
SELECT f.Daughter AS Daughter
,f.Son AS Son
FOR XML Path('Childs')
,Type
)
FOR XML Path('Parents')
,Type
)
FROM Family f
FOR XML PATH('Family'), Type
Cheers!!!
No comments:
Post a Comment