<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Solomon &#187; Comma-Delimited Output</title>
	<atom:link href="http://www.ms.oyangudi.com/blog/tag/comma-delimited-output/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.ms.oyangudi.com/blog</link>
	<description>from Oyangudi...</description>
	<lastBuildDate>Sat, 21 Aug 2010 11:35:54 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Comma-Delimited Output (SQL Server)</title>
		<link>http://www.ms.oyangudi.com/blog/sql-server/comma-delimited-output-sql-server/</link>
		<comments>http://www.ms.oyangudi.com/blog/sql-server/comma-delimited-output-sql-server/#comments</comments>
		<pubDate>Sat, 02 May 2009 10:26:00 +0000</pubDate>
		<dc:creator>Solomon</dc:creator>
				<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[Comma-Delimited Output]]></category>
		<category><![CDATA[Comma-Seperated Output]]></category>

		<guid isPermaLink="false">http://www.ms.oyangudi.com/blog/?p=45</guid>
		<description><![CDATA[Using Query: use Northwind GO declare @CustIDs varchar(8000) select top 10 @CustIDs = isnull(@CustIDs + ',', '') + CustomerID from Customers select @CustIDs GO Using Cursor: declare cCustomerIDs cursor for select [CustomerID] from [dbo].[Customers] order by [CustomerID] declare @CustomerIDs varchar(8000) declare @CustomerID varchar(10) open cCustomerIDs fetch next from cCustomerIDs into @CustomerID while @@FETCH_STATUS = 0 [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Using Query:</strong></p>
<pre class="brush: sql;">

use Northwind
GO

declare @CustIDs varchar(8000)

select top 10
        @CustIDs = isnull(@CustIDs + ',', '') + CustomerID
from    Customers

select  @CustIDs

GO
</pre>
<p><strong>Using Cursor:</strong></p>
<pre class="brush: sql;">

declare cCustomerIDs cursor for

select [CustomerID] from [dbo].[Customers] order by [CustomerID]

declare @CustomerIDs varchar(8000)

declare @CustomerID varchar(10)

open cCustomerIDs

fetch next from cCustomerIDs into @CustomerID

while @@FETCH_STATUS = 0
    begin

        set @CustomerIDs = isnull(@CustomerIDs + ',', '') + @CustomerID

        fetch next from cCustomerIDs into @CustomerID

    end

close cCustomerIDs

deallocate cCustomerIDs

select  @CustomerIDs as CustomerIDs

GO
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.ms.oyangudi.com/blog/sql-server/comma-delimited-output-sql-server/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
