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 |
|
mittalpa
Starting Member
2 Posts |
Posted - 2009-02-04 : 17:45:36
|
| HiIn SQL 2005, I am trying to get a csv strin like "1212,1122,1123,1124" out of following xml.<group> <id>1212</id> <id>1122</id> <id>1123</id> <id>1124</id></group>Please advise how it can be done?ThanksPankaj |
|
|
bklr
Master Smack Fu Yak Hacker
1693 Posts |
Posted - 2009-02-05 : 01:05:18
|
| [code]check thisDECLARE @r XMLSET @r = '<group><id>1212</id><id>1122</id><id>1123</id><id>1124</id></group>'select stuff((SELECT ','+ t.n.value('text()[1]', 'VARCHAR(100)')FROM @r.nodes('/*/*') AS t(n) for xml path('')),1,1,'')[/code] |
 |
|
|
|
|
|