You are here: Re: Nested Nodes in XML from a table « MsSQL Server « IT news, forums, messages
Re: Nested Nodes in XML from a table

Posted by Erland Sommarskog on 12/10/05 21:45

coosa (coosa76@gmail.com) writes:
> I have tried the function you wrote me and it works, but i need it in
> the format i meantioned earlier; namely:
><?xml version="1.0" encoding="utf-8" ?>
><Hardware>
> <Category name="PC" id="1">
> <Category name="Networks" id="2" />
> <Category name="Audio" id="3" />
> <Category name="Video" id="4">
> <Category name="TV Cards" id="5" />
> <Category name="Graphics Cards" id="6">
> <Category name="AGP" id="7" />
> <Category name="PCI" id="8" />
> </Category>
> </Category>
> <Category name="Input Devices" id="9" />
> </Category>
></Hardware>
>
> The format given by your function creates XML Elements which i don't
> want. As a matter of fact, i'm not good at XML either, so I tried to
> use the FOR XML AUTO instead FOR XML Path('....'); that generated no
> elements,

It appears to be an easy one, but maybe I'm jumping the gun to quickly.

The original function had:

select e.EmployeeID as '@employeeID'
,c.lastName + ', ' + c.firstName as 'name'
,@depth as 'depth'
,dbo.directReports(e.employeeID,0)

If you just change 'name' to '@name' and 'depth' to '@depth' that
should cut it, I think.


--
Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация