0

I have 4 rows. Each one contains ony symbol. Using XML PATH('') I combine them in one string. What should I obtain is ' ab' (space, space, a, b). Instead of it I get next thing '&#x20&#x20ab' (i cut semicolons because it is not visible then) How to convert first symbols back to regular spaces?

niydiyin
  • 67
  • 5
  • 1
    See if this helps: http://codecorner.galanter.net/2009/06/25/t-sql-string-aggregate-in-sql-server/ you need to use `.value()` function – Yuriy Galanter Apr 04 '14 at 20:53
  • Remember if you are going to output this to a webpage there is no difference between space and – Hogan Apr 04 '14 at 20:56
  • If you are using .NET you could also use this utility function on the resultant string [HttpUtility.HtmlDecode](http://msdn.microsoft.com/en-us/library/system.web.httputility.htmldecode(v=vs.110).aspx) – Hogan Apr 04 '14 at 21:00
  • possible duplicate of [How to decode string to XML string in C#](http://stackoverflow.com/questions/6757019/how-to-decode-string-to-xml-string-in-c-sharp) – Hogan Apr 04 '14 at 21:04
  • Yuiy, your article is perfect, everything works. Thanks! – niydiyin Apr 04 '14 at 21:07

1 Answers1

0

Solved like in this article: http://codecorner.galanter.net/2009/06/25/t-sql-string-aggregate-in-sql-server/ Just added .value('root[1]','varchar(max)') Thanks to Yuriy Galanter

niydiyin
  • 67
  • 5