<?xml version="1.0" encoding="ISO-8859-1"?>

<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/">
	<channel>
		<title>DevX.com Forums - Database</title>
		<link>http://forums.devx.com/</link>
		<description>SQL Server, Oracle, DB2, Informix, FoxPro, MySQL, or
just plain SQL language issues.</description>
		<language>en</language>
		<lastBuildDate>Fri, 24 May 2013 19:03:44 GMT</lastBuildDate>
		<generator>vBulletin</generator>
		<ttl>60</ttl>
		<image>
			<url>http://forums.devx.com/images/misc/rss.png</url>
			<title>DevX.com Forums - Database</title>
			<link>http://forums.devx.com/</link>
		</image>
		<item>
			<title>Stored Procedure to generate a comma seperated list</title>
			<link>http://forums.devx.com/showthread.php?185229-Stored-Procedure-to-generate-a-comma-seperated-list&amp;goto=newpost</link>
			<pubDate>Wed, 24 Apr 2013 21:05:14 GMT</pubDate>
			<description>I frequently run into a situation where I need to find all entries in a table for a particular key value and then build a simple list of the values seperated by commas. 
Usually I display this list either in a Textbox on a form or in a report.

Simple Example: List all Fruit in the Products Table

In my VB code I create a recordset for all Products where the Type is Fruit and then loop through the records and build my string, which in this case would look something like this:
Apple, Orange, Peach, Pare, Strawberry, Mango

Is there a way to turn this VB code into a stored procedure in SQL Server?

I seem to be building lists like this a lot so a stored procedure, to get the processing of of the client onto the server, would be very handy.

Thanks!</description>
			<content:encoded><![CDATA[<div>I frequently run into a situation where I need to find all entries in a table for a particular key value and then build a simple list of the values seperated by commas. <br />
Usually I display this list either in a Textbox on a form or in a report.<br />
<br />
Simple Example: List all Fruit in the Products Table<br />
<br />
In my VB code I create a recordset for all Products where the Type is Fruit and then loop through the records and build my string, which in this case would look something like this:<br />
Apple, Orange, Peach, Pare, Strawberry, Mango<br />
<br />
Is there a way to turn this VB code into a stored procedure in SQL Server?<br />
<br />
I seem to be building lists like this a lot so a stored procedure, to get the processing of of the client onto the server, would be very handy.<br />
<br />
Thanks!</div>

 ]]></content:encoded>
			<category domain="http://forums.devx.com/forumdisplay.php?106-Database">Database</category>
			<dc:creator>Ron Weller</dc:creator>
			<guid isPermaLink="true">http://forums.devx.com/showthread.php?185229-Stored-Procedure-to-generate-a-comma-seperated-list</guid>
		</item>
	</channel>
</rss>
