Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 SELECT Statement

Author  Topic 

DeepakNewton
Starting Member

39 Posts

Posted - 2008-05-21 : 14:26:53
Dear All,
I would like to get the solution for the below sample data
in the Table

PARAMID DETID FKID Desc Type Name value
1 1 1 A St PersonalName Raj
2 1 1 A dt Date 12/30/2007
3 1 1 A St age 23
1 2 1 A St PersonalName vimal
2 2 1 A dt Date 12/30/2007
3 2 1 A St age 25
4 3 2 B st companyName xyz
5 3 2 B st Add Mumbai

Now i would like to get the result in the XML format as
<Report>
<DETID @id=1>
<DESC>A</DESC>
<TYPES>
<PARAM @ID=1>
<TYPE>ST</TYPE>
<NAME>PersonalName</NAME>
<Value>Raj</AGE>
</PARAM>
<PARAM @ID=2>
<TYPE>DT</TYPE>
<NAME>Date</NAME>
<Value>12/23/2008</Value>
</PARAM>
<PARAM @ID=3>
<TYPE>ST</TYPE>
<NAME>AGE</NAME>
<Value>25</Value>
<PARAM>
<TYPES>
.
.
.
</DETID>
<DET@id=2>
<DESC>A</DESC>
.
.
</Report>

Please give a solution

cat_jesus
Aged Yak Warrior

547 Posts

Posted - 2008-05-21 : 16:04:48
Did you look at "for XML" in Books Online?

An infinite universe is the ultimate cartesian product.
Go to Top of Page
   

- Advertisement -