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,999 of 19,505   
   Erland Sommarskog to giancarlo.francesconi@gmail.com   
   Re: Get XML values from nodes and child    
   10 Feb 14 23:45:13   
   
   From: esquel@sommarskog.se   
      
    (giancarlo.francesconi@gmail.com) writes:   
   > I only get the first node values (NumeroProgressivo, CodiceFiscale), but   
   > not the child nodes (cognome, nome sesso...)   
   >   
      
      
   DECLARE @xml xml =   
   '   
     001   
     CSTNDA69P90H523R   
        
   	CAST   
   	NADIR   
   	F   
   	10091979   
   	RONCA   
   	BL   
        
      
      
     002   
     PRSGRI74L29F443L   
        
   	PERISSI   
   	IGOR   
   	M   
   	29071970   
   	MONTE   
   	SA   
        
   '   
      
   SELECT   
   X.valore.query('NumeroProgressivo').value('.', 'VARCHAR(20)') as   
   NumeroProgressivo,   
   X.valore.query('CodiceFiscale').value('.', 'VARCHAR(16)') as CodiceFiscale ,   
   Y.valore.query('Cognome').value('.', 'VARCHAR(16)') as Cognome,   
   Y.valore.query('Nome').value('.', 'VARCHAR(16)') as Nome,   
   Y.valore.query('Sesso').value('.', 'VARCHAR(16)') as Sesso,   
   Y.valore.query('DataNascita').value('.', 'VARCHAR(8)') as DataNascita,   
   Y.valore.query('ComuneNascita').value('.', 'VARCHAR(16)') as ComuneNascita,   
   Y.valore.query('ProvinciaNascita').value('.', 'VARCHAR(16)') as   
   ProvinciaNascita   
   FROM @xml.nodes('/Locatore') AS X(valore)   
   CROSS APPLY X.valore.nodes('PersoneFisiche') AS Y(valore)   
      
      
      
   --   
   Erland Sommarskog, Stockholm, esquel@sommarskog.se   
      
   --- 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