home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.databases.ms-sqlserver      Notorious Rube Goldberg contraption      19,505 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 19,037 of 19,505   
   Bal Govind to giancarlo....@gmail.com   
   Re: Get XML values from nodes and child    
   11 Mar 14 05:28:50   
   
   From: balgovindjss@gmail.com   
      
   On Monday, February 10, 2014 3:50:41 PM UTC+5:30, giancarlo....@gmail.com   
   wrote:   
   > Hi everybody. My XML file is:   
   >   
   >    
   >   
   >   001   
   >   
   >   CSTNDA69P90H523R   
   >   
   >      
   >   
   > 	CAST   
   >   
   > 	NADIR   
   >   
   > 	F   
   >   
   > 	10091979   
   >   
   > 	RONCA   
   >   
   > 	BL   
   >   
   >      
   >   
   >    
   >   
   >    
   >   
   >   002   
   >   
   >   PRSGRI74L29F443L   
   >   
   >      
   >   
   > 	PERISSI   
   >   
   > 	IGOR   
   >   
   > 	M   
   >   
   > 	29071970   
   >   
   > 	MONTE   
   >   
   > 	SA   
   >   
   >      
   >   
   >    
   >   
   >   
   >   
   > I need to get in ONE RECORD, both node value and his child nodes values,   
   like this   
   >   
   > 001 | CSTNDA69P90H523R | CAST    | NADIR | F | 10091979 | RONCA | BL   
   >   
   > 002 | PRSGRI74L29F443L | PERISSI | IGOR  | M | 29071970 | MONTE | SA   
   >   
   > ....   
   >   
   >   
   >   
   > With this:   
   >   
   > SELECT   
   >   
   > X.valore.query('NumeroProgressivo').value('.', 'VARCHAR(20)') as   
   NumeroProgressivo,   
   >   
   > X.valore.query('CodiceFiscale').value('.', 'VARCHAR(16)') as CodiceFiscale   
   >   
   >   
   >   
   > FROM Tbulk   
   >   
   > CROSS APPLY Tbulk.nodes('Fornitura/Documento/Soggetti/PrimoModulo/Locatore')   
   AS X(valore);   
   >   
   >   
   >   
   > I only get the first node values (NumeroProgressivo, CodiceFiscale), but not   
   the child nodes (cognome, nome sesso...)   
      
      
   You can do it using OpenXML query that is an easy approach i think :)   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca