Nesting dis-similar hierarchies

Tech-Archive recommends: Speed Up your PC by fixing your registry



I would like to build an xml structure similar to this:
<Bracket>
<Teams>
<Team>Something</Team>
</Teams>
<Games>
<Game>Something Else</Game>
</Games>
</Bracket>

My attempt follows:

select 1 AS Tag,
NULL AS Parent,
NULL AS [Teams!1!TeamGroup!element],
NULL AS [Team!2!TeamIndex],
NULL AS [Team!2!TeamName!element],
NULL AS [Team!2!TeamNumber!element] FROM Teams
UNION
SELECT 2, 1, NULL, TeamIndex , ReqTeamName , TeamNumber from Teams
UNION
SELECT 1 AS TAG, NULL AS Parent,
NULL AS [Games!1!GameGroup!element],
NULL AS [Game!2!BracketNumber],
NULL AS [Game!2!GameNumber],
NULL AS [Game!2!Time] FROM stGames WHERE BracketNumber=1
UNION
SELECT 2,1, NULL, BracketNumber, GameNumber, [Time] FROM stGames WHERE
BracketNumber = 1

I get back a nasty error:

[Microsoft][ODBC SQL Server Driver][DBNETLIB]ConnectionCheckForData
(CheckforData()).
Server: Msg 11, Level 16, State 1, Line 0
General network error. Check your network documentation.

Connection Broken

Any thoughts,

TIA

Tom
.



Relevant Pages

  • Re: Challenge: nested FOR XML EXPLICIT query with data not in target t
    ... AS Tag ... ,NULL AS Parent ... FROM vConsolidationPrinting ... UNION ALL ...
    (microsoft.public.sqlserver.xml)
  • Re: FOR XML EXPLICIT - Empty Tags?
    ... You can do it by adding another tag (and therefore another UNION) to your ... SELECT 1 AS Tag, ... FOR XML EXPLICIT ... I need to output a query in a given XML format and I figure I'd have a stab ...
    (microsoft.public.sqlserver.xml)
  • Re: A simple notation, again
    ... I'm trying to come up with a bracket notation for a "literal ... You would have to extend the syntax to ... insert to "union". ... complement of the view must also respect the complements of A and B, ...
    (comp.databases.theory)
  • Re: Nesting dis-similar hierarchies
    ... is a tag that groups teams and games. ... The whole thought behind making this one XML ... > UNION ... > BracketNumber, GameNumber, ...
    (microsoft.public.sqlserver.xml)
  • Re: Two questions about the following lines of code
    ... I really don't see how it reads the tag to see what type of data ... Are you perhaps confused by the enumeration? ... case, DAYS and HOURSMINUTES, corresponding to 0 and 1, respectively, ... "tag" field and only modifies the intended field of the union. ...
    (comp.lang.c)