September 26, 2012 at 3:24 pm
September 26, 2012 at 3:29 pm
The query can be made to handle XML special characters by doing this
SELECT t.id,
STUFF(
(
SELECT ';'+x.col1
FROM @MyTable x
WHERE x.id=t.id
ORDER BY x.col1
FOR XML PATH(''),TYPE
).value('.','VARCHAR(1000)'),1,1,'') as con_str
FROM @MyTable t
GROUP BY t.id;
____________________________________________________
Deja View - The strange feeling that somewhere, sometime you've optimised this query before
How to get the best help on a forum
http://www.sqlservercentral.com/articles/Best+Practices/61537September 26, 2012 at 5:38 pm
Or create your own CLR user-defined aggregate
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
September 26, 2012 at 6:39 pm
peterhe (9/26/2012)
Please vote:
Make it easier for others:
September 26, 2012 at 8:00 pm
Nice trick Mark.
September 26, 2012 at 9:20 pm
Viewing 6 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply