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 2005 Forums
 Transact-SQL (2005)
 Output in XML

Author  Topic 

dass05555
Yak Posting Veteran

55 Posts

Posted - 2008-06-27 : 04:56:57



In my table, i'm having the below mentioned data,
i want to get this data in xml format

id reportid Report
1 ZHOSP Hold order for sales person
2 HOU Hold Order For Users
3 ZCOSP cancel order sales person
4 ZCOWSL CancelOldOrderWeeklySmartList


Kindly help me,
thanks in advance.

cool...,

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-06-27 : 06:28:58

select * from @test for xml auto ,elements
Go to Top of Page

dass05555
Yak Posting Veteran

55 Posts

Posted - 2008-06-27 : 08:44:36
thanks Visakh..,

Is anyother way to get XML output.

cool...,
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-06-27 : 09:44:45
quote:
Originally posted by dass05555

thanks Visakh..,

Is anyother way to get XML output.

cool...,


Yup. you can use also RAW and EXPLICIT modes of FOR XML
Go to Top of Page

jezemine
Master Smack Fu Yak Hacker

2886 Posts

Posted - 2008-06-27 : 09:56:04
don't use EXPLICIT. EXPLICIT is an abomination.

use FOR XML PATH if you have complicated xml to create.


elsasoft.org
Go to Top of Page
   

- Advertisement -