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)
 For XML Explicit - Same Level - Diff Elements??

Author  Topic 

travich
Starting Member

19 Posts

Posted - 2008-08-14 : 10:23:28
Is the below possible? When I've tried to write this query, I get the following error:

Msg 6812, Level 16, State 1, Procedure sel_TicketXML, Line 133
XML tag ID 3 that was originally declared as 'LINEITEMS' is being redeclared as 'CREWMEMBERS'.

If it is not possible, then what is my best approach to cramming all of this into one XML using XML for explicit? Thanks for your help, I've searched online for hours now and am a little stuck.


<Ticket>
<LineItems>
<LineItem/>
<LineItem/>
<LineItem/>
</LineItems>
<CrewMembers>
<CrewMember/>
<CrewMember/>
<CrewMember/>
</CrewMembers>
<Ticket>

Transact Charlie
Master Smack Fu Yak Hacker

3451 Posts

Posted - 2008-08-14 : 11:33:27
Please post your query.

-------------
Charlie
Go to Top of Page

travich
Starting Member

19 Posts

Posted - 2008-08-14 : 11:37:53
quote:
Originally posted by Transact Charlie

Please post your query.

-------------
Charlie



I didn't post it because it's actually much, much larger than that... this was just a concept I wanted to ask about. If it's necessary then I will post it. I just want to know if it's even possible.
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-08-14 : 13:56:19
the xml looks ok except that you dont have close tag for ticket
it should be </ticket>
Go to Top of Page

jezemine
Master Smack Fu Yak Hacker

2886 Posts

Posted - 2008-08-15 : 01:11:01
if you are using 2005, you'd be better off using FOR XML PATH. FOR XML EXPLICIT is an abomination.


elsasoft.org
Go to Top of Page
   

- Advertisement -