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 |
|
shaik.zakeer
Posting Yak Master
117 Posts |
Posted - 2010-02-26 : 07:31:18
|
| HiI have a xml string . How can i get the attributes and the node values like belowEx:<Employee> <id>1</id> <name>xxx</name> <marks>45</mark> <class>7</class></Employee>Result:Attribute Name ValueID 1Name xxxmarks 45class 7Kindly help me ASAP.Thanks Jack |
|
|
shaik.zakeer
Posting Yak Master
117 Posts |
Posted - 2010-03-08 : 11:04:01
|
| hii found the solution for the above probdeclare @xml xmlset @xml = '<Employee><id>1</id><name>xxx</name><marks>45</marks><class>7</class></Employee>'select x.value('local-name(.)','varchar(50)) as attributename, x.value('.','varchar(50)') as valuefrom @xml.nodes('/*/*') n(x)Thanks Jack |
 |
|
|
|
|
|