all groups > sql server mseq > october 2006 >
You're in the

sql server mseq

group:

Hierarchy Data in XML


Hierarchy Data in XML Sekhar
10/10/2006 11:01:02 AM
sql server mseq:
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
Re: Hierarchy Data in XML Kent Tegels
10/10/2006 6:15:06 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

AddThis Social Bookmark Button