Bonjour,
je charge un fichier XML dans SQL SERVER grace à OPENXML.
Pour une balise "time", je peux avoir plusieurs balises property, dans le code ci dessus, j'en ai 2, mais le code me renvoi qu'une ligne :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23 DECLARE @idoc int SELECT @XMLdoc = '<?xml version="1.0"?> <TracePollData> <traces> <time>2011-09-14T19:46:07.043Z</time> <property> <key>ATY</key> <value>LI</value> </property> <property> <key>TOTO</key> <value>TATA</value> </property> </traces> </TracePollData> ' EXEC sp_xml_preparedocument @idoc OUTPUT, @XMLDoc SELECT * FROM OPENXML (@idoc, 'TracePollData/traces') WITH (time varchar(50) 'time', [key] varchar(15) 'property/key', value Varchar(15) 'property/value') EXEC sp_xml_removedocument @idoc
2011-09-14T19:46:07.043Z ATY LI
J'aimerai qu'il me retourne 2 lignes :
2011-09-14T19:46:07.043Z ATY LI
2011-09-14T19:46:07.043Z TOTO TATA
Comment faire ?
Merci
Partager