Home > Archive > MS SQL Server MSEQ > October 2006 > Hierarchy Data in XML









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Hierarchy Data in XML
Sekhar

2006-10-24, 6:49 pm

Hello All

I have two Table Employee and Dept

Employee Columns
EmpID
EmpName
MgrID
DeptID

EmpID(PK) MgrID (FK)

Dept COlumns

DeptID
DeptName

I need to return XMl Hierarchy when I pass DeptID as a parameter
So my final result shoudl look like this

<Dept>
<Emp ID="" Name="" .....>
<Emp ID="" Name="">
</Emp>
</Emp>
<Emp ID="" Name="">
</Emp>
<Emp ID="" Name="">
</Emp>
</Dept>

How do I write this Query

Regards

Kent Tegels

2006-10-24, 6:49 pm

Hello Sekhar,

Take a look at the example I posted yesterday in microsoft.public.sqlserver.programming
in the post about returning arrays.

Thanks,
Kent Tegels
http://staff.develop.com/ktegels/


Sponsored Links





Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive | Programming forum archive

Copyright 2008 droptable.com