|
Hello all, I have select statement as below:
When I get XML file its not like what I want. The elements are nested.
What i want is all the
(comments are locked)
|
|
I suggest you give BOL a read. Here's the article that discusses how to use http://msdn.microsoft.com/en-us/library/ms188273.aspx I think my first step would be to avoid using
(comments are locked)
|
|
FOR XML AUTO tries to guess what to do but making a hierarchy of your tables. When I have had to accomplish something similar to what you are doing, I wrapped my query inside another SELECT statement like this:
Output:
As a general note, however, I agree with Melvyn that you should avoid SELECT * in your query. However, to use the technique I used, specify the specific fields you want in the subquery and then use SELECT * in the outer query. Your above query gives me the result shown below. which is same as what i was getting. Can you tell me if it is SQL version problem? I am using SQL 2000 and 2005. My output is as below. 1 1 1 1
Oct 21 '09 at 10:30 AM
Pranav
Can you please copy/paste the query you used to get that output? If you ran the query I wrote, I don't understand why it was formatted that way or why you are missing all of the details fields.
Oct 21 '09 at 11:51 AM
Tom Staab
The output i have given in previous comment is not having * in select query, rather the elements i wanted are selected were regestrationid and all cistomerids.
Oct 22 '09 at 01:27 AM
Pranav
The output i get from your above query is as below: 1 CustInfo details 1 CustAcctInfo details 1 CreditInfo details 1 CreditInfoExtention details
Oct 22 '09 at 01:28 AM
Pranav
(comments are locked)
|

