| 
	
 | 
 Posted by rhaazy on 06/12/70 11:56 
<root> 
<USA> 
  <Manistique> 
     <M-Sales/> 
     <M-IT/> 
  </Manistique> 
  <Houston> 
     <H-Sales/> 
     <H-IT/> 
   </Houston> 
</USA> 
<CANADA> 
  <Toronto> 
etc... 
</root> 
 
Hopefully this format is possible... 
Erland Sommarskog wrote: 
> rhaazy (rhaazy@gmail.com) writes: 
> > I figured the query out, simple actually:S 
> > 
> > select tblOrgSystem.OrgSystem, A.OrgNode, 
> > B.OrgNode from 
> > tblOrgSystemNodeParent join tblOrgSystem on tblOrgSystem.OrgSystemID = 
> > tblOrgSystemNodeParent.OrgSystemID join tblOrgSystemNode A on 
> > A.OrgNodeID = tblOrgSystemNodeParent.OrgNodeID 
> > join tblOrgSystemNode B on 
> > B.OrgNodeID = tblOrgSystemNodeParent.OrgNodeID 
> > 
> > However I still can't figure the XML portion of this out, I would like 
> > it to look like this: 
> > 
> > USA 
> >   Manistique 
> >      M-Sales 
> >      M-IT 
> >   Houston 
> >      H-Sales 
> >      H-IT 
> > CANADA 
> > etc.... 
> 
> That does not look like XML to me. 
> 
> > I want to bind this to a treeview so it can be easily navigated. 
> 
> Maybe treeviews eat XML documents for lunch, but this a newsgroup about 
> server software, and we don't know about GUIs. At least I don't. 
> 
> So please post the XML document you want as output. For a tested query, 
> it's also helps if you post CREATE TABLE statements for you tables, and 
> sample data as INSERT statements. (And my experience of FOR XML ELEMENT 
> is limited, so I need to test before I make a fool of myself in public.) 
> 
> Also, please specify which version of SQL Server you are using. 
> 
> -- 
> Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se 
> 
> Books Online for SQL Server 2005 at 
> http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx 
> Books Online for SQL Server 2000 at 
> http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx
 
  
Navigation:
[Reply to this message] 
 |