<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://www.kodyaz.com/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>Microsoft SQL Server 2008</title><link>http://www.kodyaz.com/forums/85/ShowForum.aspx</link><description>Microsoft SQL Server 2008 (code name Katmai) Data Platform and components for SQL Server administrators and T-SQL Developers</description><dc:language>en-US</dc:language><generator>CommunityServer 2.0 (Build: 60217.2664)</generator><item><title>Re: Can I &amp;quot;flatten&amp;quot; multiple rows into one line in a #temp table?</title><link>http://www.kodyaz.com/forums/thread/34321.aspx</link><pubDate>Fri, 27 Jul 2012 12:09:09 GMT</pubDate><guid isPermaLink="false">d71855bd-9cf6-4123-85a4-fb2751b2daa4:34321</guid><dc:creator>miteshaegis</dc:creator><slash:comments>0</slash:comments><comments>http://www.kodyaz.com/forums/thread/34321.aspx</comments><wfw:commentRss>http://www.kodyaz.com/forums/commentrss.aspx?SectionID=85&amp;PostID=34321</wfw:commentRss><description>We want to display record in one line in sql than use the select query in sql server.&lt;br&gt;&lt;br&gt;select table id,
	stuff(
	(
		select 
			' | ' + 
			date +': ' + note
		from #t t2
		where t2.id = t1.id
		for xml path('')
	), 1,4, '') note
from #table table1


&lt;br&gt;</description></item><item><title>Re: Can I &amp;quot;flatten&amp;quot; multiple rows into one line in a #temp table?</title><link>http://www.kodyaz.com/forums/thread/34298.aspx</link><pubDate>Thu, 12 Jul 2012 08:57:56 GMT</pubDate><guid isPermaLink="false">d71855bd-9cf6-4123-85a4-fb2751b2daa4:34298</guid><dc:creator>eralper</dc:creator><slash:comments>0</slash:comments><comments>http://www.kodyaz.com/forums/thread/34298.aspx</comments><wfw:commentRss>http://www.kodyaz.com/forums/commentrss.aspx?SectionID=85&amp;PostID=34298</wfw:commentRss><description>Hello ncccapt,&lt;br /&gt;
Please review the SQL concatenation tutorial at &lt;a href="http://www.kodyaz.com/articles/concatenate-using-xml-path.aspx" target="_blank"&gt;http://www.kodyaz.com/articles/concatenate-using-xml-path.aspx&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
And here is sample sql concatenate query that will help you solve your question.&lt;br /&gt;
&lt;br /&gt;
select distinct id,
	stuff(
	(
		select 
			' | ' + 
			date +': ' + note
		from #t t2
		where t2.id = t1.id
		for xml path('')
	), 1,3, '') note
from #t t1</description></item><item><title>Can I &amp;quot;flatten&amp;quot; multiple rows into one line in a #temp table?</title><link>http://www.kodyaz.com/forums/thread/34249.aspx</link><pubDate>Wed, 06 Jun 2012 04:38:00 GMT</pubDate><guid isPermaLink="false">d71855bd-9cf6-4123-85a4-fb2751b2daa4:34249</guid><dc:creator>ncc1701capt</dc:creator><slash:comments>0</slash:comments><comments>http://www.kodyaz.com/forums/thread/34249.aspx</comments><wfw:commentRss>http://www.kodyaz.com/forums/commentrss.aspx?SectionID=85&amp;PostID=34249</wfw:commentRss><description>I have a table containing notes for leads like this:&lt;br /&gt;ID   DATE      NOTE&lt;br /&gt;---   ----------   ------------------------&lt;br /&gt;10   1/1/12   New Lead&lt;br /&gt;10   2/8/12   set meeting&lt;br /&gt;15   2/4/12   New Lead&lt;br /&gt;15   3/9/12   set meeting&lt;br /&gt;15   5/7/12   signed contract&lt;br /&gt;&lt;br /&gt;I would like to create a #temp table in a Stored Proc that holds the data like this:&lt;br /&gt;ID    NOTE&lt;br /&gt;----   --------------------------------------------------------------------------&lt;br /&gt;10   1/1/12: New Lead | 2/8/12: Set Meeting&lt;br /&gt;15   2/4/12: New Lead | 3/9/12: Set meeting | 5/7/12: signed contract&lt;br /&gt;&lt;br /&gt;where I concatenate the date+': '+ note+' | '+... and the next date, note, etc for as many rows as there are for a given ID in the original notes table (there may be different # of rows for different IDs, obviously)...&lt;br /&gt;Is this possible?&lt;br /&gt;&lt;br /&gt;Thanks in advance!</description></item></channel></rss>