Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
peddi_praveen
Starting Member
48 Posts |
Posted - 2005-05-18 : 06:44:57
|
| Hi all, Following is the XML string which I'm trying to parse, but getting only the value of attribute. How can I display all the values associated with this?declare @idoc intdeclare @doc varchar(1000)set @doc ='<content><meta key="Testing Records" data-type="decimal"> <values> <value>81023002</value> <value>81023003</value> <value>81112401</value> </values></meta></content>'EXEC sp_xml_preparedocument @idoc OUTPUT, @docSELECT *FROM OPENXML (@idoc, '/content/meta/values',2) WITH ([key] VARCHAR(100) '../@key', value VARCHAR(1000) )Expected output Testing Records - 81023002Testing Records - 81023003Testing Records - 81112401Praveen |
|
|
Arnold Fribble
Yak-finder General
1961 Posts |
Posted - 2005-05-18 : 07:26:44
|
Do you want something like this, then?SELECT *FROM OPENXML (@idoc, '/content/meta/values/value',2)WITH ([key] VARCHAR(100) '../../@key', value VARCHAR(1000) '.') The XPath pattern that's the second parameter of OPENXML determines the cardinality of the result. |
 |
|
|
peddi_praveen
Starting Member
48 Posts |
Posted - 2005-05-19 : 01:28:59
|
| Hi,Exactly, We are looking for the same.Tx alot.regards,Praveen |
 |
|
|
|
|
|
|
|