Handling special characters with FOR XML PATH('')

Posted by Rob Farley on SQL Blog See other posts from SQL Blog or by Rob Farley
Published on Thu, 15 Apr 2010 03:35:47 GMT Indexed on 2010/04/15 3:43 UTC
Read the original article Hit count: 794

Filed under:
Because I hate seeing > or & in my results… Since SQL Server 2005, we’ve been able to use FOR XML PATH('') to do string concatenation. I’ve blogged about it before several times. But I don’t think I’ve blogged about the fact that it all goes a bit wrong if you have special characters in the strings you’re concatenating. Generally, I don’t even worry about this. I should, but I don’t, particularly when the solution is so easy. Suppose I want to concatenate the list of user databases...(read more)

© SQL Blog or respective owner

Related posts about sql