<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
		>
<channel>
	<title>Comments on: SQL SERVER &#8211; Create a Comma Delimited List Using SELECT Clause From Table Column</title>
	<atom:link href="http://blog.sqlauthority.com/2008/06/04/sql-server-create-a-comma-delimited-list-using-select-clause-from-table-column/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.sqlauthority.com/2008/06/04/sql-server-create-a-comma-delimited-list-using-select-clause-from-table-column/</link>
	<description>Notes of a SQL Server MVP and Database Administrator</description>
	<lastBuildDate>Sun, 21 Mar 2010 03:48:32 +0000</lastBuildDate>
	<generator>http://wordpress.com/</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: vineela</title>
		<link>http://blog.sqlauthority.com/2008/06/04/sql-server-create-a-comma-delimited-list-using-select-clause-from-table-column/#comment-62606</link>
		<dc:creator>vineela</dc:creator>
		<pubDate>Wed, 10 Mar 2010 09:45:42 +0000</pubDate>
		<guid isPermaLink="false">http://sqlauthority.wordpress.com/?p=631#comment-62606</guid>
		<description>hai 

Could any one help me how to get rid of my problem

My problem is:
table name: countryID

accid localaccid names
———————————————–
101 222 india
102 333 india
103 444 india

201 777 usa
202 888 usa
————————————————

I need like this 

names localaccid accid
————————————————–
india 222,333,444 101,102,103
usa 777,888 201,202
—————————————————

please how to solve this problem.</description>
		<content:encoded><![CDATA[<p>hai </p>
<p>Could any one help me how to get rid of my problem</p>
<p>My problem is:<br />
table name: countryID</p>
<p>accid localaccid names<br />
———————————————–<br />
101 222 india<br />
102 333 india<br />
103 444 india</p>
<p>201 777 usa<br />
202 888 usa<br />
————————————————</p>
<p>I need like this </p>
<p>names localaccid accid<br />
————————————————–<br />
india 222,333,444 101,102,103<br />
usa 777,888 201,202<br />
—————————————————</p>
<p>please how to solve this problem.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: vineela</title>
		<link>http://blog.sqlauthority.com/2008/06/04/sql-server-create-a-comma-delimited-list-using-select-clause-from-table-column/#comment-62605</link>
		<dc:creator>vineela</dc:creator>
		<pubDate>Wed, 10 Mar 2010 09:45:09 +0000</pubDate>
		<guid isPermaLink="false">http://sqlauthority.wordpress.com/?p=631#comment-62605</guid>
		<description>hai 

Could any one help me how to get rid of my problem

My problem is:
table name: countryID

accid        localaccid        names
-----------------------------------------------
101             222               india
102             333               india
103             444               india

201             777               usa
202             888               usa
------------------------------------------------

I need like this 

names        localaccid                    accid
--------------------------------------------------
india             222,333,444              101,102,103
usa               777,888                     201,202
---------------------------------------------------


please how to solve this problem.</description>
		<content:encoded><![CDATA[<p>hai </p>
<p>Could any one help me how to get rid of my problem</p>
<p>My problem is:<br />
table name: countryID</p>
<p>accid        localaccid        names<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
101             222               india<br />
102             333               india<br />
103             444               india</p>
<p>201             777               usa<br />
202             888               usa<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;</p>
<p>I need like this </p>
<p>names        localaccid                    accid<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
india             222,333,444              101,102,103<br />
usa               777,888                     201,202<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;</p>
<p>please how to solve this problem.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: re</title>
		<link>http://blog.sqlauthority.com/2008/06/04/sql-server-create-a-comma-delimited-list-using-select-clause-from-table-column/#comment-62262</link>
		<dc:creator>re</dc:creator>
		<pubDate>Fri, 05 Mar 2010 17:37:31 +0000</pubDate>
		<guid isPermaLink="false">http://sqlauthority.wordpress.com/?p=631#comment-62262</guid>
		<description>This works great</description>
		<content:encoded><![CDATA[<p>This works great</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Shyamala</title>
		<link>http://blog.sqlauthority.com/2008/06/04/sql-server-create-a-comma-delimited-list-using-select-clause-from-table-column/#comment-59202</link>
		<dc:creator>Shyamala</dc:creator>
		<pubDate>Thu, 31 Dec 2009 12:13:42 +0000</pubDate>
		<guid isPermaLink="false">http://sqlauthority.wordpress.com/?p=631#comment-59202</guid>
		<description>HI
 i want to separate the values given in a single row separeted by comma into multiple row..


for eg 
Input :  ab,bc,cd,de

output:
ab
bc
cd
de</description>
		<content:encoded><![CDATA[<p>HI<br />
 i want to separate the values given in a single row separeted by comma into multiple row..</p>
<p>for eg<br />
Input :  ab,bc,cd,de</p>
<p>output:<br />
ab<br />
bc<br />
cd<br />
de</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tejas Shah</title>
		<link>http://blog.sqlauthority.com/2008/06/04/sql-server-create-a-comma-delimited-list-using-select-clause-from-table-column/#comment-57760</link>
		<dc:creator>Tejas Shah</dc:creator>
		<pubDate>Fri, 20 Nov 2009 05:42:07 +0000</pubDate>
		<guid isPermaLink="false">http://sqlauthority.wordpress.com/?p=631#comment-57760</guid>
		<description>Hi Vikram,

You can do this as:

DECLARE @str VARCHAR(100)
SELECT @str = &#039;12345678,abcdefgh&#039;

SELECT	@str,
		SUBSTRING(@str, 0 , CHARINDEX(&#039;,&#039;,@str)) AS [1stColunmn],
		SUBSTRING(@str, CHARINDEX(&#039;,&#039;,@str) + 1, LEN(@str)) AS [2ndColumn]

Thanks,

Tejas</description>
		<content:encoded><![CDATA[<p>Hi Vikram,</p>
<p>You can do this as:</p>
<p>DECLARE @str VARCHAR(100)<br />
SELECT @str = &#8216;12345678,abcdefgh&#8217;</p>
<p>SELECT	@str,<br />
		SUBSTRING(@str, 0 , CHARINDEX(&#8216;,&#8217;,@str)) AS [1stColunmn],<br />
		SUBSTRING(@str, CHARINDEX(&#8216;,&#8217;,@str) + 1, LEN(@str)) AS [2ndColumn]</p>
<p>Thanks,</p>
<p>Tejas</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Vikram</title>
		<link>http://blog.sqlauthority.com/2008/06/04/sql-server-create-a-comma-delimited-list-using-select-clause-from-table-column/#comment-57751</link>
		<dc:creator>Vikram</dc:creator>
		<pubDate>Thu, 19 Nov 2009 20:52:43 +0000</pubDate>
		<guid isPermaLink="false">http://sqlauthority.wordpress.com/?p=631#comment-57751</guid>
		<description>What if you have a (,) within a string, and you just want
to separate the each side into it&#039;s own column.

Example:

12345678,abcdefgh

How can this be done?</description>
		<content:encoded><![CDATA[<p>What if you have a (,) within a string, and you just want<br />
to separate the each side into it&#8217;s own column.</p>
<p>Example:</p>
<p>12345678,abcdefgh</p>
<p>How can this be done?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Bojan</title>
		<link>http://blog.sqlauthority.com/2008/06/04/sql-server-create-a-comma-delimited-list-using-select-clause-from-table-column/#comment-56776</link>
		<dc:creator>Bojan</dc:creator>
		<pubDate>Sun, 18 Oct 2009 18:36:44 +0000</pubDate>
		<guid isPermaLink="false">http://sqlauthority.wordpress.com/?p=631#comment-56776</guid>
		<description>Hi to All,

if you add an ORDER BY clause, and if it&#039;s order by a varchar column there is a problem. Example:

USE AdventureWorks
GO
DECLARE @listStr VARCHAR(MAX)
SELECT @listStr = COALESCE(@listStr+&#039;,&#039; ,&#039;&#039;) + Name
FROM Production.Product
ORDER BY COLUMN_NAME  
SELECT @listStr
GO

If a COLUMN_NAME is a VARCHAR type, result of a query is not comma separated list but a single item. In your example, it would be a single name without a comma. If a COLUMN_NAME is a date or int type, it works just fine. What&#039;s the catch?</description>
		<content:encoded><![CDATA[<p>Hi to All,</p>
<p>if you add an ORDER BY clause, and if it&#8217;s order by a varchar column there is a problem. Example:</p>
<p>USE AdventureWorks<br />
GO<br />
DECLARE @listStr VARCHAR(MAX)<br />
SELECT @listStr = COALESCE(@listStr+&#8217;,&#8217; ,&#8221;) + Name<br />
FROM Production.Product<br />
ORDER BY COLUMN_NAME<br />
SELECT @listStr<br />
GO</p>
<p>If a COLUMN_NAME is a VARCHAR type, result of a query is not comma separated list but a single item. In your example, it would be a single name without a comma. If a COLUMN_NAME is a date or int type, it works just fine. What&#8217;s the catch?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mazharkhan</title>
		<link>http://blog.sqlauthority.com/2008/06/04/sql-server-create-a-comma-delimited-list-using-select-clause-from-table-column/#comment-56493</link>
		<dc:creator>Mazharkhan</dc:creator>
		<pubDate>Wed, 07 Oct 2009 09:52:41 +0000</pubDate>
		<guid isPermaLink="false">http://sqlauthority.wordpress.com/?p=631#comment-56493</guid>
		<description>Hi Freinds,

I have one Query is,
I have one Table. It has a colum Named RoleID. in this column i have records like &#039;3,4,6&#039;.  and my query is if i want to select value for &#039;4&#039;. 
For Example: In Table I have 5 records. in RoleID column like this

ID    Name    RoldeID
-------------------------------
1      Mr.A         2
2      Mr.B         2,5 
3      Mr.C         3,4
4      Mr.D         2,3,5  
5      Mr.E         3,5 

Now I want to select Records where RoleId = 3.
when i pass select query like this,
Select * from table where RoleID = 3.  then it is not getting any data.

I m New in SQL please Help.

Thanks,
Mazhar</description>
		<content:encoded><![CDATA[<p>Hi Freinds,</p>
<p>I have one Query is,<br />
I have one Table. It has a colum Named RoleID. in this column i have records like &#8216;3,4,6&#8242;.  and my query is if i want to select value for &#8216;4&#8242;.<br />
For Example: In Table I have 5 records. in RoleID column like this</p>
<p>ID    Name    RoldeID<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
1      Mr.A         2<br />
2      Mr.B         2,5<br />
3      Mr.C         3,4<br />
4      Mr.D         2,3,5<br />
5      Mr.E         3,5 </p>
<p>Now I want to select Records where RoleId = 3.<br />
when i pass select query like this,<br />
Select * from table where RoleID = 3.  then it is not getting any data.</p>
<p>I m New in SQL please Help.</p>
<p>Thanks,<br />
Mazhar</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Nagendra</title>
		<link>http://blog.sqlauthority.com/2008/06/04/sql-server-create-a-comma-delimited-list-using-select-clause-from-table-column/#comment-56228</link>
		<dc:creator>Nagendra</dc:creator>
		<pubDate>Tue, 29 Sep 2009 06:14:20 +0000</pubDate>
		<guid isPermaLink="false">http://sqlauthority.wordpress.com/?p=631#comment-56228</guid>
		<description>In the above example i want to pass the table name as parameter.

can anybody help me to do this.

thanks
Nagendra</description>
		<content:encoded><![CDATA[<p>In the above example i want to pass the table name as parameter.</p>
<p>can anybody help me to do this.</p>
<p>thanks<br />
Nagendra</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jvc</title>
		<link>http://blog.sqlauthority.com/2008/06/04/sql-server-create-a-comma-delimited-list-using-select-clause-from-table-column/#comment-52935</link>
		<dc:creator>Jvc</dc:creator>
		<pubDate>Thu, 11 Jun 2009 10:14:06 +0000</pubDate>
		<guid isPermaLink="false">http://sqlauthority.wordpress.com/?p=631#comment-52935</guid>
		<description>hi 
i have a requirement

*12345678901115100609*22345678901115100609*12355678901115100609*&#039;
this is string in sqlserver..i want first 10 digits as machine code
next 4digits as a time and last 6digits as date..&quot;*&quot; symbol is
neglected

result like:
machine            time             date
1234567890       1115         100609
2234567890        1115         100609</description>
		<content:encoded><![CDATA[<p>hi<br />
i have a requirement</p>
<p>*12345678901115100609*22345678901115100609*12355678901115100609*&#8217;<br />
this is string in sqlserver..i want first 10 digits as machine code<br />
next 4digits as a time and last 6digits as date..&#8221;*&#8221; symbol is<br />
neglected</p>
<p>result like:<br />
machine            time             date<br />
1234567890       1115         100609<br />
2234567890        1115         100609</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Brian Tkatch</title>
		<link>http://blog.sqlauthority.com/2008/06/04/sql-server-create-a-comma-delimited-list-using-select-clause-from-table-column/#comment-51210</link>
		<dc:creator>Brian Tkatch</dc:creator>
		<pubDate>Wed, 22 Apr 2009 12:41:24 +0000</pubDate>
		<guid isPermaLink="false">http://sqlauthority.wordpress.com/?p=631#comment-51210</guid>
		<description>Kevin,

 In GROUP BY any COLUMN reported must be also in the GROUP BY, hence there is nothing to aggregate.</description>
		<content:encoded><![CDATA[<p>Kevin,</p>
<p> In GROUP BY any COLUMN reported must be also in the GROUP BY, hence there is nothing to aggregate.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Kevin the novice</title>
		<link>http://blog.sqlauthority.com/2008/06/04/sql-server-create-a-comma-delimited-list-using-select-clause-from-table-column/#comment-51185</link>
		<dc:creator>Kevin the novice</dc:creator>
		<pubDate>Wed, 22 Apr 2009 00:35:54 +0000</pubDate>
		<guid isPermaLink="false">http://sqlauthority.wordpress.com/?p=631#comment-51185</guid>
		<description>This is really great. Thank you. 

Is it possible to improve it to include a GROUP BY? I have a table with two columns (ID, Marker). I want to list all of the Markers that exist for each ID as in:

ID         Marker_List
--------------------------------------
1          001, 002
300      002
478      008, 985, 212</description>
		<content:encoded><![CDATA[<p>This is really great. Thank you. </p>
<p>Is it possible to improve it to include a GROUP BY? I have a table with two columns (ID, Marker). I want to list all of the Markers that exist for each ID as in:</p>
<p>ID         Marker_List<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
1          001, 002<br />
300      002<br />
478      008, 985, 212</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Kerr</title>
		<link>http://blog.sqlauthority.com/2008/06/04/sql-server-create-a-comma-delimited-list-using-select-clause-from-table-column/#comment-45435</link>
		<dc:creator>Kerr</dc:creator>
		<pubDate>Wed, 07 Jan 2009 14:57:19 +0000</pubDate>
		<guid isPermaLink="false">http://sqlauthority.wordpress.com/?p=631#comment-45435</guid>
		<description>I was looking for a way to convert a column into a comma delimited list, and this worked great, thanks!</description>
		<content:encoded><![CDATA[<p>I was looking for a way to convert a column into a comma delimited list, and this worked great, thanks!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: prakash02</title>
		<link>http://blog.sqlauthority.com/2008/06/04/sql-server-create-a-comma-delimited-list-using-select-clause-from-table-column/#comment-44867</link>
		<dc:creator>prakash02</dc:creator>
		<pubDate>Wed, 17 Dec 2008 05:22:33 +0000</pubDate>
		<guid isPermaLink="false">http://sqlauthority.wordpress.com/?p=631#comment-44867</guid>
		<description>Hi,
Can i use comma seperation in Where clause?

Such as  where age=40,height=5; etc?

Thanks
Om</description>
		<content:encoded><![CDATA[<p>Hi,<br />
Can i use comma seperation in Where clause?</p>
<p>Such as  where age=40,height=5; etc?</p>
<p>Thanks<br />
Om</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Henk</title>
		<link>http://blog.sqlauthority.com/2008/06/04/sql-server-create-a-comma-delimited-list-using-select-clause-from-table-column/#comment-41917</link>
		<dc:creator>Henk</dc:creator>
		<pubDate>Fri, 22 Aug 2008 13:39:22 +0000</pubDate>
		<guid isPermaLink="false">http://sqlauthority.wordpress.com/?p=631#comment-41917</guid>
		<description>I need learnig the QSL-Server also 
Need quik help now!
Get job in 3 dayz
You give help me?</description>
		<content:encoded><![CDATA[<p>I need learnig the QSL-Server also<br />
Need quik help now!<br />
Get job in 3 dayz<br />
You give help me?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: sushma</title>
		<link>http://blog.sqlauthority.com/2008/06/04/sql-server-create-a-comma-delimited-list-using-select-clause-from-table-column/#comment-41081</link>
		<dc:creator>sushma</dc:creator>
		<pubDate>Wed, 30 Jul 2008 21:18:37 +0000</pubDate>
		<guid isPermaLink="false">http://sqlauthority.wordpress.com/?p=631#comment-41081</guid>
		<description>Hi ,
My name is Sushma.
I am new to learning SQL SQRVER (developer).
I need some programs links.
I am new to this so i am faceing lot of problems(even i dont know codding) plz help me.

Thanks
Sushma.</description>
		<content:encoded><![CDATA[<p>Hi ,<br />
My name is Sushma.<br />
I am new to learning SQL SQRVER (developer).<br />
I need some programs links.<br />
I am new to this so i am faceing lot of problems(even i dont know codding) plz help me.</p>
<p>Thanks<br />
Sushma.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Steve</title>
		<link>http://blog.sqlauthority.com/2008/06/04/sql-server-create-a-comma-delimited-list-using-select-clause-from-table-column/#comment-39611</link>
		<dc:creator>Steve</dc:creator>
		<pubDate>Mon, 30 Jun 2008 21:11:25 +0000</pubDate>
		<guid isPermaLink="false">http://sqlauthority.wordpress.com/?p=631#comment-39611</guid>
		<description>I thought these were all good suggestions until I realized it ws only good for one column.

Is there something similar that would do it for all coluns in a table. For example, I create a temp table with all the data  I need to Export then I do something like this:

Select
   Column_1+&#039;,&#039;+
   Column_2+&#039;,&#039;+
   Column_3+&#039;,&#039;+
   Column_4+&#039;,&#039;+
   Column_5+&#039;,&#039;+
   Column_6+&#039;,&#039;+ 
   Column_7+&#039;,&#039;+
   Column_8
From TableToExport

Any suggestions? Some times I may have 100 or more columsn from various tables.

Thanks</description>
		<content:encoded><![CDATA[<p>I thought these were all good suggestions until I realized it ws only good for one column.</p>
<p>Is there something similar that would do it for all coluns in a table. For example, I create a temp table with all the data  I need to Export then I do something like this:</p>
<p>Select<br />
   Column_1+&#8217;,'+<br />
   Column_2+&#8217;,'+<br />
   Column_3+&#8217;,'+<br />
   Column_4+&#8217;,'+<br />
   Column_5+&#8217;,'+<br />
   Column_6+&#8217;,'+<br />
   Column_7+&#8217;,'+<br />
   Column_8<br />
From TableToExport</p>
<p>Any suggestions? Some times I may have 100 or more columsn from various tables.</p>
<p>Thanks</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: lleston</title>
		<link>http://blog.sqlauthority.com/2008/06/04/sql-server-create-a-comma-delimited-list-using-select-clause-from-table-column/#comment-39328</link>
		<dc:creator>lleston</dc:creator>
		<pubDate>Wed, 18 Jun 2008 14:42:01 +0000</pubDate>
		<guid isPermaLink="false">http://sqlauthority.wordpress.com/?p=631#comment-39328</guid>
		<description>Hello, Pinal

I agree with you, COALESCE is a good idea (and a good function too), but in your script just the started value of the variable prevent a resultset NULL, but if any value from the list is null (in this case the &quot;name&quot; field), the entire resultset become NULL too. I suggest the follow solution:

USE AdventureWorks
GO
DECLARE @listStr VARCHAR(MAX)
SELECT 
     @listStr = 
     COALESCE ( COALESCE(@listStr+‘,’ ,”) + Name , @listStr)
FROM Production.Product
SELECT @listStr
GO</description>
		<content:encoded><![CDATA[<p>Hello, Pinal</p>
<p>I agree with you, COALESCE is a good idea (and a good function too), but in your script just the started value of the variable prevent a resultset NULL, but if any value from the list is null (in this case the &#8220;name&#8221; field), the entire resultset become NULL too. I suggest the follow solution:</p>
<p>USE AdventureWorks<br />
GO<br />
DECLARE @listStr VARCHAR(MAX)<br />
SELECT<br />
     @listStr =<br />
     COALESCE ( COALESCE(@listStr+‘,’ ,”) + Name , @listStr)<br />
FROM Production.Product<br />
SELECT @listStr<br />
GO</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Balasubramaniyam</title>
		<link>http://blog.sqlauthority.com/2008/06/04/sql-server-create-a-comma-delimited-list-using-select-clause-from-table-column/#comment-39315</link>
		<dc:creator>Balasubramaniyam</dc:creator>
		<pubDate>Wed, 18 Jun 2008 09:56:36 +0000</pubDate>
		<guid isPermaLink="false">http://sqlauthority.wordpress.com/?p=631#comment-39315</guid>
		<description>Hai,
Msg 102, Level 15, State 1, Line 2
Incorrect syntax near &#039;‘&#039;.

This error message is displayed when executing this query.</description>
		<content:encoded><![CDATA[<p>Hai,<br />
Msg 102, Level 15, State 1, Line 2<br />
Incorrect syntax near &#8216;‘&#8217;.</p>
<p>This error message is displayed when executing this query.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: pinaldave</title>
		<link>http://blog.sqlauthority.com/2008/06/04/sql-server-create-a-comma-delimited-list-using-select-clause-from-table-column/#comment-39238</link>
		<dc:creator>pinaldave</dc:creator>
		<pubDate>Sun, 15 Jun 2008 03:07:07 +0000</pubDate>
		<guid isPermaLink="false">http://sqlauthority.wordpress.com/?p=631#comment-39238</guid>
		<description>Shashi Kant chauhan,

COALESCE is required for non null values. If there is NULL Value in your string you will have your resultset as NULL.

Using COALESCE is good idea.

Regards,
Pinal Dave 
( http://www.SQLAuthority.com )</description>
		<content:encoded><![CDATA[<p>Shashi Kant chauhan,</p>
<p>COALESCE is required for non null values. If there is NULL Value in your string you will have your resultset as NULL.</p>
<p>Using COALESCE is good idea.</p>
<p>Regards,<br />
Pinal Dave<br />
( <a href="http://www.SQLAuthority.com" rel="nofollow">http://www.SQLAuthority.com</a> )</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: shashi Kant Chauhan</title>
		<link>http://blog.sqlauthority.com/2008/06/04/sql-server-create-a-comma-delimited-list-using-select-clause-from-table-column/#comment-39231</link>
		<dc:creator>shashi Kant Chauhan</dc:creator>
		<pubDate>Sat, 14 Jun 2008 13:26:33 +0000</pubDate>
		<guid isPermaLink="false">http://sqlauthority.wordpress.com/?p=631#comment-39231</guid>
		<description>Hi Pinal ,
There is no need of COALESCE function for this string column with comma sepration. you can do it in this way also without using COALESCE. I did this thing in sql server 2000 and 2005

USE PUBS
GO
DECLARE @Result AS VARCHAR(2000)
SET @Results = &#039;&#039;

SELECT @Results = au_lname +&#039;, &#039;+ @Results  FROM
authors 

SELECT @Results
GO
----------------------------And Your Query would be like this-----

USE AdventureWorks
GO
DECLARE @listStr VARCHAR(MAX)
SET @listStr = &#039;&#039;
SELECT @listStr = Name + &#039;, &#039; + @listStr
    FROM Production.Product
SELECT @listStr
GO


Regards
Shashi Kant chauhan</description>
		<content:encoded><![CDATA[<p>Hi Pinal ,<br />
There is no need of COALESCE function for this string column with comma sepration. you can do it in this way also without using COALESCE. I did this thing in sql server 2000 and 2005</p>
<p>USE PUBS<br />
GO<br />
DECLARE @Result AS VARCHAR(2000)<br />
SET @Results = &#8221;</p>
<p>SELECT @Results = au_lname +&#8217;, &#8216;+ @Results  FROM<br />
authors </p>
<p>SELECT @Results<br />
GO<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-And Your Query would be like this&#8212;&#8211;</p>
<p>USE AdventureWorks<br />
GO<br />
DECLARE @listStr VARCHAR(MAX)<br />
SET @listStr = &#8221;<br />
SELECT @listStr = Name + &#8216;, &#8216; + @listStr<br />
    FROM Production.Product<br />
SELECT @listStr<br />
GO</p>
<p>Regards<br />
Shashi Kant chauhan</p>
]]></content:encoded>
	</item>
</channel>
</rss>
