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 18,995 of 19,505   
   giancarlo.francesconi@gmail.com to All   
   Get XML values from nodes and child node   
   10 Feb 14 02:20:41   
   
   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...)   
      
   --- 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