<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://www2.sqlblog.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Rowset string concatenation: Which method is best?</title><link>http://www2.sqlblog.com/blogs/adam_machanic/archive/2006/07/12/rowset-string-concatenation-which-method-is-best.aspx</link><description>Yeah, yeah, yeah, let's get this out of the way right from the start: Don't concatenate rows into delimited strings in SQL Server. Do it client side. Except if you really have to create delimited strings in SQL Server. In which case you should read on.</description><dc:language>en</dc:language><generator>CommunityServer 2.1 SP2 (Build: 61129.1)</generator><item><title>re: Rowset string concatenation: Which method is best?</title><link>http://www2.sqlblog.com/blogs/adam_machanic/archive/2006/07/12/rowset-string-concatenation-which-method-is-best.aspx#960</link><pubDate>Fri, 09 Mar 2007 15:27:37 GMT</pubDate><guid isPermaLink="false">21093a07-8b3d-42db-8cbf-3350fcbf5496:960</guid><dc:creator>Ulises</dc:creator><description>&lt;p&gt;There is yet another approach to test, that performance wise seems to provide its advantages: &lt;/p&gt;
&lt;p&gt;DECLARE @EmployeeList varchar(100)&lt;/p&gt;
&lt;p&gt;SELECT @EmployeeList = COALESCE(@EmployeeList + ', ', '') + &lt;/p&gt;
&lt;p&gt; &amp;nbsp; CAST(Emp_UniqueID AS varchar(5))&lt;/p&gt;
&lt;p&gt;FROM SalesCallsEmployees&lt;/p&gt;
&lt;p&gt;SELECT @EmployeeList&lt;/p&gt;
&lt;p&gt;I saw it on this website: &lt;a rel="nofollow" target="_new" href="http://www.sqlteam.com/item.asp?ItemID=2368"&gt;http://www.sqlteam.com/item.asp?ItemID=2368&lt;/a&gt;&lt;/p&gt;
</description></item><item><title>re: Rowset string concatenation: Which method is best?</title><link>http://www2.sqlblog.com/blogs/adam_machanic/archive/2006/07/12/rowset-string-concatenation-which-method-is-best.aspx#1007</link><pubDate>Sun, 18 Mar 2007 16:16:07 GMT</pubDate><guid isPermaLink="false">21093a07-8b3d-42db-8cbf-3350fcbf5496:1007</guid><dc:creator>Adam Machanic</dc:creator><description>&lt;p&gt;Hi Ulises,&lt;/p&gt;
&lt;p&gt;That should be exactly the same as the CASE expression from a perf POV.&lt;/p&gt;
</description></item><item><title>re: Rowset string concatenation: Which method is best?</title><link>http://www2.sqlblog.com/blogs/adam_machanic/archive/2006/07/12/rowset-string-concatenation-which-method-is-best.aspx#1042</link><pubDate>Wed, 28 Mar 2007 07:54:23 GMT</pubDate><guid isPermaLink="false">21093a07-8b3d-42db-8cbf-3350fcbf5496:1042</guid><dc:creator>Peter Larsson</dc:creator><description>&lt;p&gt;What about this SQL Server 2005 attempt?&lt;/p&gt;
&lt;p&gt;-- Prepare sample data&lt;/p&gt;
&lt;p&gt;DECLARE	@Sample TABLE (ID INT, Code VARCHAR(3))&lt;/p&gt;
&lt;p&gt;INSERT	@Sample&lt;/p&gt;
&lt;p&gt;SELECT	290780, 'LT' UNION ALL&lt;/p&gt;
&lt;p&gt;SELECT	290780, 'AY' UNION ALL&lt;/p&gt;
&lt;p&gt;SELECT	290781, 'ILS' UNION ALL&lt;/p&gt;
&lt;p&gt;SELECT	290780, 'AY'&lt;/p&gt;
&lt;p&gt;-- Show the expected output&lt;/p&gt;
&lt;p&gt;SELECT DISTINCT	s1.ID,&lt;/p&gt;
&lt;p&gt;		STUFF((SELECT DISTINCT TOP 100 PERCENT ',' + s2.CODE FROM @Sample AS s2 WHERE s2.ID = s1.ID ORDER BY ',' + s2.CODE FOR XML PATH('')), 1, 1, '') AS CODES&lt;/p&gt;
&lt;p&gt;FROM		@Sample AS s1&lt;/p&gt;
&lt;p&gt;ORDER BY	s1.ID&lt;/p&gt;
&lt;p&gt;SELECT DISTINCT	s1.ID,&lt;/p&gt;
&lt;p&gt;		STUFF((SELECT TOP 100 PERCENT ',' + s2.CODE FROM @Sample AS s2 WHERE s2.ID = s1.ID ORDER BY ',' + s2.CODE FOR XML PATH('')), 1, 1, '') AS CODES&lt;/p&gt;
&lt;p&gt;FROM		@Sample AS s1&lt;/p&gt;
&lt;p&gt;ORDER BY	s1.ID&lt;/p&gt;
&lt;p&gt;SELECT DISTINCT	s1.ID,&lt;/p&gt;
&lt;p&gt;		STUFF((SELECT ',' + s2.CODE FROM @Sample AS s2 WHERE s2.ID = s1.ID FOR XML PATH('')), 1, 1, '') AS CODES&lt;/p&gt;
&lt;p&gt;FROM		@Sample AS s1&lt;/p&gt;
&lt;p&gt;ORDER BY	s1.ID&lt;/p&gt;
</description></item><item><title>re: Rowset string concatenation: Which method is best?</title><link>http://www2.sqlblog.com/blogs/adam_machanic/archive/2006/07/12/rowset-string-concatenation-which-method-is-best.aspx#1274</link><pubDate>Tue, 22 May 2007 18:07:23 GMT</pubDate><guid isPermaLink="false">21093a07-8b3d-42db-8cbf-3350fcbf5496:1274</guid><dc:creator>Adam Machanic</dc:creator><description>&lt;P&gt;Hi Peter,&lt;/P&gt;
&lt;P&gt;FOR XML PATH will definitely outperform virtually all other methods. &amp;nbsp;Plus, it's documented/supported. &amp;nbsp;In 2005, it's absolutely the best choice!&lt;/P&gt;</description></item><item><title>re: Rowset string concatenation: Which method is best?</title><link>http://www2.sqlblog.com/blogs/adam_machanic/archive/2006/07/12/rowset-string-concatenation-which-method-is-best.aspx#3272</link><pubDate>Sat, 10 Nov 2007 06:15:20 GMT</pubDate><guid isPermaLink="false">21093a07-8b3d-42db-8cbf-3350fcbf5496:3272</guid><dc:creator>Oscar</dc:creator><description>&lt;p&gt;You made my day Adam, Thank you VERY much, i was thinking on ussing cursors to obtain each variable field to obtain the ones to concatenate linked to those fields, i didn't code anything because you kept me of doing it, your solution is eficient, fast and easy, i dont have a lot of experience developing applications, i am doing a distribution service management application on asp nowdays, and i really understood your explanation. What book would u suggest me to learn the sql things that they didnt teach me at school, which is the best method to learn sql, besides constant reading?.&lt;/p&gt;
&lt;p&gt;Thanks again Adam, and best Regards. &amp;nbsp;&lt;/p&gt;
</description></item><item><title>re: Rowset string concatenation: Which method is best?</title><link>http://www2.sqlblog.com/blogs/adam_machanic/archive/2006/07/12/rowset-string-concatenation-which-method-is-best.aspx#4387</link><pubDate>Fri, 04 Jan 2008 16:12:26 GMT</pubDate><guid isPermaLink="false">21093a07-8b3d-42db-8cbf-3350fcbf5496:4387</guid><dc:creator>Anonymous</dc:creator><description>&lt;p&gt;With SQL 2005 another possibility exists. &amp;nbsp;Custom Aggregate functions using the CLR. &amp;nbsp;The Microsoft documentation even uses concatenation as their example.&lt;/p&gt;
</description></item><item><title>re: Rowset string concatenation: Which method is best?</title><link>http://www2.sqlblog.com/blogs/adam_machanic/archive/2006/07/12/rowset-string-concatenation-which-method-is-best.aspx#9044</link><pubDate>Tue, 23 Sep 2008 12:00:58 GMT</pubDate><guid isPermaLink="false">21093a07-8b3d-42db-8cbf-3350fcbf5496:9044</guid><dc:creator>Ashish</dc:creator><description>&lt;p&gt;Hi Adam&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; I have been struggling with the below error while trying to run the SSIS from the one of our PRO server.&lt;/p&gt;
&lt;p&gt;Error: 2008-09-11 15:14:08.96&lt;/p&gt;
&lt;p&gt; &amp;nbsp; Code: 0xC004801F&lt;/p&gt;
&lt;p&gt; &amp;nbsp; Source: Data Flow Task Data Flow Task (DTS.Pipeline)&lt;/p&gt;
&lt;p&gt; &amp;nbsp; Description: The component metadata for &amp;quot;component &amp;quot;DataReader Source&amp;quot; (157)&amp;quot; could not be upgraded to the newer version of the component. The PerformUpgrade method failed.&lt;/p&gt;
&lt;p&gt;End Error&lt;/p&gt;
&lt;p&gt;I am unable to understand how to remove this error, can you please help me on this?&lt;/p&gt;
</description></item><item><title>re: Rowset string concatenation: Which method is best?</title><link>http://www2.sqlblog.com/blogs/adam_machanic/archive/2006/07/12/rowset-string-concatenation-which-method-is-best.aspx#9721</link><pubDate>Thu, 30 Oct 2008 20:19:35 GMT</pubDate><guid isPermaLink="false">21093a07-8b3d-42db-8cbf-3350fcbf5496:9721</guid><dc:creator>Chi</dc:creator><description>&lt;p&gt;The FOR XML Path version can only concatenate up to 256 characters long. Any way to resolve this limitation?&lt;/p&gt;
</description></item><item><title>re: Rowset string concatenation: Which method is best?</title><link>http://www2.sqlblog.com/blogs/adam_machanic/archive/2006/07/12/rowset-string-concatenation-which-method-is-best.aspx#9846</link><pubDate>Mon, 03 Nov 2008 15:07:47 GMT</pubDate><guid isPermaLink="false">21093a07-8b3d-42db-8cbf-3350fcbf5496:9846</guid><dc:creator>Adam Machanic</dc:creator><description>&lt;p&gt;Hi Chi,&lt;/p&gt;
&lt;p&gt;That is not correct. &amp;nbsp;I regularly use it to form CLOB strings, and it can (in theory -- I hope not in practice) go all the way to 2 GB. &amp;nbsp;If you're hitting a 256 character wall, it's either a data type issue (VARCHAR(256)), or your UI that's making it look like you've hit a limit when you really have not.&lt;/p&gt;
</description></item><item><title>Bitmask Handling, part 2: Bitmask reconstitution</title><link>http://www2.sqlblog.com/blogs/adam_machanic/archive/2006/07/12/rowset-string-concatenation-which-method-is-best.aspx#11441</link><pubDate>Sun, 25 Jan 2009 19:47:51 GMT</pubDate><guid isPermaLink="false">21093a07-8b3d-42db-8cbf-3350fcbf5496:11441</guid><dc:creator>Adam Machanic</dc:creator><description>&lt;p&gt;Posting the first part of my series on bitmasks (yes, this is now officially a series) taught me a lot&lt;/p&gt;
</description></item><item><title>re: Rowset string concatenation: Which method is best?</title><link>http://www2.sqlblog.com/blogs/adam_machanic/archive/2006/07/12/rowset-string-concatenation-which-method-is-best.aspx#11644</link><pubDate>Mon, 02 Feb 2009 09:16:38 GMT</pubDate><guid isPermaLink="false">21093a07-8b3d-42db-8cbf-3350fcbf5496:11644</guid><dc:creator>Michael C</dc:creator><description>&lt;p&gt;&amp;quot;And so I set out to prove him wrong...&amp;quot;&lt;/p&gt;
&lt;p&gt;Interesting, I would have thought you would set out to find the best solution.....&lt;/p&gt;
</description></item><item><title>re: Rowset string concatenation: Which method is best?</title><link>http://www2.sqlblog.com/blogs/adam_machanic/archive/2006/07/12/rowset-string-concatenation-which-method-is-best.aspx#11855</link><pubDate>Thu, 12 Feb 2009 16:04:30 GMT</pubDate><guid isPermaLink="false">21093a07-8b3d-42db-8cbf-3350fcbf5496:11855</guid><dc:creator>CERU</dc:creator><description>&lt;p&gt;FOR XML PATH will convert some of the XML special characters - like &amp;amp; &amp;lt; &amp;gt; - to something else... Any way to get around that?&lt;/p&gt;
</description></item><item><title>re: Rowset string concatenation: Which method is best?</title><link>http://www2.sqlblog.com/blogs/adam_machanic/archive/2006/07/12/rowset-string-concatenation-which-method-is-best.aspx#11879</link><pubDate>Fri, 13 Feb 2009 20:39:25 GMT</pubDate><guid isPermaLink="false">21093a07-8b3d-42db-8cbf-3350fcbf5496:11879</guid><dc:creator>Adam Machanic</dc:creator><description>&lt;p&gt;CERU: Absolutely:&lt;/p&gt;
&lt;p&gt;---&lt;/p&gt;
&lt;p&gt;DECLARE @t TABLE (x CHAR(1))&lt;/p&gt;
&lt;p&gt;INSERT @t&lt;/p&gt;
&lt;p&gt;SELECT '&amp;amp;'&lt;/p&gt;
&lt;p&gt;UNION ALL&lt;/p&gt;
&lt;p&gt;SELECT '&amp;lt;'&lt;/p&gt;
&lt;p&gt;UNION ALL &lt;/p&gt;
&lt;p&gt;SELECT '&amp;gt;'&lt;/p&gt;
&lt;p&gt;SELECT&lt;/p&gt;
&lt;p&gt;(&lt;/p&gt;
&lt;p&gt;	SELECT &lt;/p&gt;
&lt;p&gt;		(&lt;/p&gt;
&lt;p&gt;			SELECT x AS [text()]&lt;/p&gt;
&lt;p&gt;			FROM @t&lt;/p&gt;
&lt;p&gt;			FOR XML PATH(''), TYPE&lt;/p&gt;
&lt;p&gt;		) AS r&lt;/p&gt;
&lt;p&gt;	FOR XML RAW, TYPE&lt;/p&gt;
&lt;p&gt;).value('(/row/r)[1]', 'varchar(max)')&lt;/p&gt;
&lt;p&gt;---&lt;/p&gt;
</description></item><item><title>re: Rowset string concatenation: Which method is best?</title><link>http://www2.sqlblog.com/blogs/adam_machanic/archive/2006/07/12/rowset-string-concatenation-which-method-is-best.aspx#12003</link><pubDate>Thu, 19 Feb 2009 14:44:50 GMT</pubDate><guid isPermaLink="false">21093a07-8b3d-42db-8cbf-3350fcbf5496:12003</guid><dc:creator>CERU</dc:creator><description>&lt;p&gt;Great!.. Thanks&lt;/p&gt;
&lt;p&gt;I read somewhere that FOR XML will be removed in future version.. that is a shame since I just found how to do this.. Thanks for your help!&lt;/p&gt;
</description></item><item><title>re: Rowset string concatenation: Which method is best?</title><link>http://www2.sqlblog.com/blogs/adam_machanic/archive/2006/07/12/rowset-string-concatenation-which-method-is-best.aspx#12007</link><pubDate>Thu, 19 Feb 2009 15:40:14 GMT</pubDate><guid isPermaLink="false">21093a07-8b3d-42db-8cbf-3350fcbf5496:12007</guid><dc:creator>Adam Machanic</dc:creator><description>&lt;p&gt;Hi CERU,&lt;/p&gt;
&lt;p&gt;FOR XML EXPLICIT is deprecated, but FOR XML is not and I don't expect it to be removed anytime in the foreseeable future. XML is an absolutely vital technology at this point, and the FOR XML syntax -- especially the FOR XML PATH variant -- is one of the key elements of SQL Server's XML support. &amp;nbsp;Since it's not currently on the deprecation path it has to stay around for at least four more major versions of the product, so it should be with us for at least 10 more years at a minimum. &amp;nbsp;And I certainly don't expect it to be deprecated in SQL11, so we can expect it to be around for a lot longer than that. &amp;nbsp;So get comfortable with it... It's here to stay.&lt;/p&gt;
</description></item><item><title>re: Rowset string concatenation: Which method is best?</title><link>http://www2.sqlblog.com/blogs/adam_machanic/archive/2006/07/12/rowset-string-concatenation-which-method-is-best.aspx#12113</link><pubDate>Mon, 23 Feb 2009 18:01:25 GMT</pubDate><guid isPermaLink="false">21093a07-8b3d-42db-8cbf-3350fcbf5496:12113</guid><dc:creator>RBArryYoung</dc:creator><description>&lt;p&gt;Adam:&lt;/p&gt;
&lt;p&gt;Here's the FOR XML fix that I have been using, it seems simpler and appears to work just as well. &amp;nbsp;Have I missed anything?&lt;/p&gt;
&lt;p&gt;--=====&lt;/p&gt;
&lt;p&gt;select (&lt;/p&gt;
&lt;p&gt;	SELECT n + ','&lt;/p&gt;
&lt;p&gt;	FROM (&lt;/p&gt;
&lt;p&gt;		SELECT 'a&amp;lt;b' AS n&lt;/p&gt;
&lt;p&gt;		UNION ALL&lt;/p&gt;
&lt;p&gt;		SELECT 'b&amp;gt;a'&lt;/p&gt;
&lt;p&gt;		UNION ALL&lt;/p&gt;
&lt;p&gt;		SELECT 'b&amp;amp;a'&lt;/p&gt;
&lt;p&gt;		UNION ALL&lt;/p&gt;
&lt;p&gt;		SELECT 'b&lt;/p&gt;
&lt;p&gt;a') r&lt;/p&gt;
&lt;p&gt;	FOR XML PATH(''), TYPE&lt;/p&gt;
&lt;p&gt;).value('.[1]','varchar(max)')&lt;/p&gt;
&lt;p&gt;--=====&lt;/p&gt;
</description></item><item><title>re: Rowset string concatenation: Which method is best?</title><link>http://www2.sqlblog.com/blogs/adam_machanic/archive/2006/07/12/rowset-string-concatenation-which-method-is-best.aspx#12120</link><pubDate>Mon, 23 Feb 2009 19:25:55 GMT</pubDate><guid isPermaLink="false">21093a07-8b3d-42db-8cbf-3350fcbf5496:12120</guid><dc:creator>Adam Machanic</dc:creator><description>&lt;p&gt;Looks good to me, RBarryYoung. &amp;nbsp;Did you come up with that, or is there someone we can credit? &amp;nbsp;I asked a group of MVPs how to solve the problem and the best anyone came up with is the version I posted to CERU (credit goes to Tony Rogerson for coming up with it). &amp;nbsp;The one you posted is certainly better and when I use it I would love to know to whom I should attribute it.&lt;/p&gt;
</description></item><item><title>T-SQL Challenge: Grouped String Concatenation</title><link>http://www2.sqlblog.com/blogs/adam_machanic/archive/2006/07/12/rowset-string-concatenation-which-method-is-best.aspx#12309</link><pubDate>Fri, 27 Feb 2009 18:24:55 GMT</pubDate><guid isPermaLink="false">21093a07-8b3d-42db-8cbf-3350fcbf5496:12309</guid><dc:creator>Adam Machanic</dc:creator><description>&lt;p&gt;It's been quite a while since the LIKE vs ? Puzzle , and I feel like it's time for another one. Response&lt;/p&gt;
</description></item><item><title>re: Rowset string concatenation: Which method is best?</title><link>http://www2.sqlblog.com/blogs/adam_machanic/archive/2006/07/12/rowset-string-concatenation-which-method-is-best.aspx#12362</link><pubDate>Sun, 01 Mar 2009 19:19:52 GMT</pubDate><guid isPermaLink="false">21093a07-8b3d-42db-8cbf-3350fcbf5496:12362</guid><dc:creator>RBArryYoung</dc:creator><description>&lt;p&gt;I came up with it after I saw the prior version that you posted here and over at Ward Pond's blog also.&lt;/p&gt;
</description></item><item><title>re: Rowset string concatenation: Which method is best?</title><link>http://www2.sqlblog.com/blogs/adam_machanic/archive/2006/07/12/rowset-string-concatenation-which-method-is-best.aspx#13885</link><pubDate>Fri, 08 May 2009 07:22:54 GMT</pubDate><guid isPermaLink="false">21093a07-8b3d-42db-8cbf-3350fcbf5496:13885</guid><dc:creator>Ali Delshad</dc:creator><description>&lt;p&gt;Hey man&lt;/p&gt;
&lt;p&gt;Thank you very much :)&lt;/p&gt;
&lt;p&gt;You make my work too much easier&lt;/p&gt;
</description></item><item><title>re: Rowset string concatenation: Which method is best?</title><link>http://www2.sqlblog.com/blogs/adam_machanic/archive/2006/07/12/rowset-string-concatenation-which-method-is-best.aspx#23869</link><pubDate>Tue, 30 Mar 2010 15:27:14 GMT</pubDate><guid isPermaLink="false">21093a07-8b3d-42db-8cbf-3350fcbf5496:23869</guid><dc:creator>JRK</dc:creator><description>&lt;p&gt;RBArryYoung...&lt;/p&gt;
&lt;p&gt;Nice one!. &lt;/p&gt;
</description></item><item><title>T-SQL Tuesday # 16 : This is not the aggregate you're looking for</title><link>http://www2.sqlblog.com/blogs/adam_machanic/archive/2006/07/12/rowset-string-concatenation-which-method-is-best.aspx#33976</link><pubDate>Tue, 08 Mar 2011 21:46:13 GMT</pubDate><guid isPermaLink="false">21093a07-8b3d-42db-8cbf-3350fcbf5496:33976</guid><dc:creator>Aaron Bertrand</dc:creator><description>&lt;p&gt;This week, T-SQL Tuesday is being hosted by Jes Borland ( blog | twitter ), and the theme is &amp;quot; Aggregate&lt;/p&gt;
</description></item><item><title>re: Rowset string concatenation: Which method is best?</title><link>http://www2.sqlblog.com/blogs/adam_machanic/archive/2006/07/12/rowset-string-concatenation-which-method-is-best.aspx#35852</link><pubDate>Tue, 24 May 2011 10:02:12 GMT</pubDate><guid isPermaLink="false">21093a07-8b3d-42db-8cbf-3350fcbf5496:35852</guid><dc:creator>Kevin</dc:creator><description>&lt;p&gt;Hello Everyone. I tried this lines of query on 2005 and it works just fine. A particular client needs it on version 2000 but it keeps giving syntax error near 'For'. Any help? here is my code:&lt;/p&gt;
&lt;p&gt;update tblLabResult&lt;/p&gt;
&lt;p&gt;set Specimen = (select distinct stuff((Select '/' + sp.[Name]&lt;/p&gt;
&lt;p&gt;from dbo.tblLabSpecimenUsed as su inner join dbo.tblLabSpecimen as sp&lt;/p&gt;
&lt;p&gt;on su.SpecimenID = sp.SpecimenID &lt;/p&gt;
&lt;p&gt;where su.ResultID = @NResultID&lt;/p&gt;
&lt;p&gt; order by su.SpecimenID	&lt;/p&gt;
&lt;p&gt;for xml path('')),1,1,'') as userlist&lt;/p&gt;
&lt;p&gt;from tblLabSpecimenUsed&lt;/p&gt;
&lt;p&gt;)&lt;/p&gt;
&lt;p&gt;where ResultID = @NResultID&lt;/p&gt;
</description></item><item><title>re: Rowset string concatenation: Which method is best?</title><link>http://www2.sqlblog.com/blogs/adam_machanic/archive/2006/07/12/rowset-string-concatenation-which-method-is-best.aspx#41154</link><pubDate>Wed, 18 Jan 2012 05:07:41 GMT</pubDate><guid isPermaLink="false">21093a07-8b3d-42db-8cbf-3350fcbf5496:41154</guid><dc:creator>sai</dc:creator><description>&lt;p&gt;FOR XML is not an option when you are working with characters like 0x0018 or ox0016 etc. it throws an exception saying that XML cannot serialize since it has those values. i don't have a clue at this point of time what to do with that. performance wise it will eliminate the need for while loop and i tested it with millions of data and it just works like a charm. can you find out a way for that and also how to add coleasce for the column. thanks&lt;/p&gt;
</description></item><item><title>re: Rowset string concatenation: Which method is best?</title><link>http://www2.sqlblog.com/blogs/adam_machanic/archive/2006/07/12/rowset-string-concatenation-which-method-is-best.aspx#41172</link><pubDate>Wed, 18 Jan 2012 16:30:51 GMT</pubDate><guid isPermaLink="false">21093a07-8b3d-42db-8cbf-3350fcbf5496:41172</guid><dc:creator>Adam Machanic</dc:creator><description>&lt;p&gt;sai: I use REPLACE to get rid of those characters. If you peek at the code for sp_whoisactive you'll see how I've done it. It's ugly but it works.&lt;/p&gt;
&lt;p&gt;Not sure what you mean about COALESCE. Can you be more specific?&lt;/p&gt;
</description></item></channel></rss>