Welcome to dbFreaks.com!
FAQFAQ    SearchSearch      ProfileProfile    Private MessagesPrivate Messages   Log inLog in

XML query result

 
   Database Help (Home) -> XML RSS
Next:  High memory pagessec  
Author Message
shwac

External


Since: Nov 14, 2008
Posts: 2



(Msg. 1) Posted: Fri Nov 14, 2008 9:35 am
Post subject: XML query result
Archived from groups: microsoft>public>sqlserver>xml (more info?)

Hi,

In SQL Server 2005 SP2, when I use a query like this:

SELECT f1, f2, f3
from myTable
for xml auto, elements

I always receive result on the same line, not formatted like a tree. Why ?

Query result example:
<MyTable><f1>A</f1><f2>10</f2><f3>1</f3></MyTable><MyTable><f1>A</f1><f2>10</f2><f3>1</f3></MyTable>

I want:

<MyTable>
<f1>A</f1>
<f2>10</f2>
<f3>1</f3>
</MyTable>
<MyTable>
<f1>A</f1>
<f2>10</f2>
<f3>1</f3>
</MyTable>

In Books Online, all query result are easily readable...

Thanks

 >> Stay informed about: XML query result 
Back to top
Login to vote
Martin Honnen

External


Since: Apr 20, 2007
Posts: 48



(Msg. 2) Posted: Fri Nov 14, 2008 2:26 pm
Post subject: Re: XML query result [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

shwac wrote:

> I always receive result on the same line, not formatted like a tree. Why ?
>
> Query result example:
> <MyTable><f1>A</f1><f2>10</f2><f3>1</f3></MyTable><MyTable><f1>A</f1><f2>10</f2><f3>1</f3></MyTable>
>
> I want:
>
> <MyTable>
> <f1>A</f1>
> <f2>10</f2>
> <f3>1</f3>
> </MyTable>
> <MyTable>
> <f1>A</f1>
> <f2>10</f2>
> <f3>1</f3>
> </MyTable>

How are you looking at the query? In SQL Server Management Studio you
can click on the XML column value and you will then get the XML display
in pretty printed (and editable) form in a separate tab.


--

Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/

 >> Stay informed about: XML query result 
Back to top
Login to vote
Display posts from previous:   
Related Topics:
xml query - I have a XML column (AuditXML), Servername (varchar(40)) column on a SQL table called dbo.AuditData AuditXML contains an XML file of a bunch of SQL properties <SqlInstance name="TC_Server1"> <Services> <Service> ...

Shaping this query - Hi, I'm having a go at an xml query but I'm having problems getting the correct results with the output xml. Say I have the following flat table: Firstname,Surname,Address1,Zip I want my xml output to be: <addresses> <address> ...

Easy query question - This one should be easy, but for some reason I can't get it. I have a table with an XML column, containing the following: <xs:ReservationChargeItem xmlns:xs="http://www.hoboo.com/ReservationSchema" DropOffCode="" PickUpCode=&quo...

Query from 2 XML data sources - Hi, Suppose I have to XML documents. The first one contains a list of authors and the second one contains a list of books. For example, author.xml -------------------------- <authors> <author @id="1"> <name>Tom</...

Distributed query and XML index - Distributed query is not supported when there is XML column in the table. So I create nvarchar column on the table and cast it to XML column in the view. However, I want to create XML index because of the performance. But XML index could not be created o...
   Database Help (Home) -> XML All times are: Pacific Time (US & Canada)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You can edit your posts in this forum
You can delete your posts in this forum
You can vote in polls in this forum



[ Contact us | Terms of Service/Privacy Policy ]