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 |
|
wkm1925
Posting Yak Master
207 Posts |
Posted - 2010-02-27 : 03:00:31
|
i'm beginner using xml as inputi've statement as follow,declare @coutshort xmlset @coutshort='<coutshortcuts><coutshortcut><cout>kl</cout><shortcuts> <shortcut>kntn</shortcut><shortcut>jb</shortcut></shortcuts></coutshortcut></coutshortcuts>' how to shred the xml data, and display as follow,cout | shortcut-----------------------kl | kntnkl | jb |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2010-02-27 : 03:25:29
|
| [code]declare @coutshort xmlset @coutshort='<coutshortcuts><coutshortcut><cout>kl</cout><shortcuts> <shortcut>kntn</shortcut><shortcut>jb</shortcut></shortcuts></coutshortcut></coutshortcuts>'select a.b.value('cout[1]','varchar(100)') as cout,t.u.value('.','varchar(100)') as shortcutfrom @coutshort.nodes('/coutshortcuts/coutshortcut') a(b)cross apply b.nodes('shortcuts/shortcut')t(u)output--------------------------cout shortcutkl kntnkl jb[/code]------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
wkm1925
Posting Yak Master
207 Posts |
Posted - 2010-02-27 : 03:28:11
|
| tq mr visakh |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2010-02-27 : 03:32:34
|
welcome ------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
|
|
|