<?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/"
		>
<channel>
	<title>Comments on: FizzBuzz in T-SQL</title>
	<atom:link href="http://robboek.com/2009/02/03/fizzbuzz-in-t-sql/feed/" rel="self" type="application/rss+xml" />
	<link>http://robboek.com/2009/02/03/fizzbuzz-in-t-sql/</link>
	<description>Husband, Father, SQL Server Consultant, Tech Geek.</description>
	<lastBuildDate>Sat, 19 Jun 2010 09:09:55 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Rob Boek</title>
		<link>http://robboek.com/2009/02/03/fizzbuzz-in-t-sql/comment-page-1/#comment-2314</link>
		<dc:creator>Rob Boek</dc:creator>
		<pubDate>Mon, 15 Mar 2010 18:18:24 +0000</pubDate>
		<guid isPermaLink="false">http://robboek.com/?p=95#comment-2314</guid>
		<description>Just updated the post with a much faster solution. There are many more solutions over at http://ask.sqlservercentral.com/questions/4241/whats-the-best-way-to-solve-the-fizzbuzz-question/.</description>
		<content:encoded><![CDATA[<p>Just updated the post with a much faster solution. There are many more solutions over at <a href="http://ask.sqlservercentral.com/questions/4241/whats-the-best-way-to-solve-the-fizzbuzz-question/" rel="nofollow">http://ask.sqlservercentral.com/questions/4241/whats-the-best-way-to-solve-the-fizzbuzz-question/</a>.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dave Collins</title>
		<link>http://robboek.com/2009/02/03/fizzbuzz-in-t-sql/comment-page-1/#comment-2311</link>
		<dc:creator>Dave Collins</dc:creator>
		<pubDate>Mon, 22 Feb 2010 12:34:48 +0000</pubDate>
		<guid isPermaLink="false">http://robboek.com/?p=95#comment-2311</guid>
		<description>Hi, how about the following for a fully set based solution...

create table #temp
(number int )
go

insert into #temp(number)
select top 100 row_number() OVER (ORDER BY [object_id]) from sys.columns;

select 
number
, case 
	when number % 3 = 0 AND  number % 5 = 0 then &#039;fizzbuzz&#039;
	when number % 3 = 0 then &#039;fizz&#039;
	when number % 5 = 0 then &#039;buzz&#039;
	else &#039;&#039; end as test
from #temp;

drop table #temp;</description>
		<content:encoded><![CDATA[<p>Hi, how about the following for a fully set based solution&#8230;</p>
<p>create table #temp<br />
(number int )<br />
go</p>
<p>insert into #temp(number)<br />
select top 100 row_number() OVER (ORDER BY [object_id]) from sys.columns;</p>
<p>select<br />
number<br />
, case<br />
	when number % 3 = 0 AND  number % 5 = 0 then &#8216;fizzbuzz&#8217;<br />
	when number % 3 = 0 then &#8216;fizz&#8217;<br />
	when number % 5 = 0 then &#8216;buzz&#8217;<br />
	else &#8221; end as test<br />
from #temp;</p>
<p>drop table #temp;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Amit</title>
		<link>http://robboek.com/2009/02/03/fizzbuzz-in-t-sql/comment-page-1/#comment-798</link>
		<dc:creator>Amit</dc:creator>
		<pubDate>Thu, 02 Apr 2009 18:13:35 +0000</pubDate>
		<guid isPermaLink="false">http://robboek.com/?p=95#comment-798</guid>
		<description>if (@n1 != 0 and @n2 != 0) not required though</description>
		<content:encoded><![CDATA[<p>if (@n1 != 0 and @n2 != 0) not required though</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Amit</title>
		<link>http://robboek.com/2009/02/03/fizzbuzz-in-t-sql/comment-page-1/#comment-797</link>
		<dc:creator>Amit</dc:creator>
		<pubDate>Thu, 02 Apr 2009 18:12:05 +0000</pubDate>
		<guid isPermaLink="false">http://robboek.com/?p=95#comment-797</guid>
		<description>declare @num	int,
	@n1	int,
	@n2	int
set @num = 1

while(@num &lt; = 100)
begin

	select @n1 = (@num%3)
	select @n2 = (@num%5)

	if (@n1 = 0)
	if (@n1 = 0 and @n2 = 0)
		Print &#039;FizzBuzz&#039;
	else
		Print &#039;Fizz&#039;
	if (@n1 != 0 and @n2 = 0)
	Print &#039;Buzz&#039;
	else
	if (@n1 != 0 and @n2 != 0)
	Print @num 	
set @num = @num + 1
end</description>
		<content:encoded><![CDATA[<p>declare @num	int,<br />
	@n1	int,<br />
	@n2	int<br />
set @num = 1</p>
<p>while(@num &lt; = 100)<br />
begin</p>
<p>	select @n1 = (@num%3)<br />
	select @n2 = (@num%5)</p>
<p>	if (@n1 = 0)<br />
	if (@n1 = 0 and @n2 = 0)<br />
		Print &#8216;FizzBuzz&#8217;<br />
	else<br />
		Print &#8216;Fizz&#8217;<br />
	if (@n1 != 0 and @n2 = 0)<br />
	Print &#8216;Buzz&#8217;<br />
	else<br />
	if (@n1 != 0 and @n2 != 0)<br />
	Print @num<br />
set @num = @num + 1<br />
end</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Another 3 SQL Server bloggers at SQLServerPedia &#124; Brent Ozar - SQL Server DBA</title>
		<link>http://robboek.com/2009/02/03/fizzbuzz-in-t-sql/comment-page-1/#comment-126</link>
		<dc:creator>Another 3 SQL Server bloggers at SQLServerPedia &#124; Brent Ozar - SQL Server DBA</dc:creator>
		<pubDate>Fri, 06 Feb 2009 12:15:49 +0000</pubDate>
		<guid isPermaLink="false">http://robboek.com/?p=95#comment-126</guid>
		<description>[...] Solving FizzBuzz with Set-Based T-SQL - I talked about using the FizzBuzz problem to filter out DBA job candidates and a couple of answers popped up on blogs.</description>
		<content:encoded><![CDATA[<p>[...] Solving FizzBuzz with Set-Based T-SQL &#8211; I talked about using the FizzBuzz problem to filter out DBA job candidates and a couple of answers popped up on blogs.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Rob Boek</title>
		<link>http://robboek.com/2009/02/03/fizzbuzz-in-t-sql/comment-page-1/#comment-114</link>
		<dc:creator>Rob Boek</dc:creator>
		<pubDate>Thu, 05 Feb 2009 13:38:08 +0000</pubDate>
		<guid isPermaLink="false">http://robboek.com/?p=95#comment-114</guid>
		<description>That would be because the default MAXRECURSION is 100. If you want to go above that, add &lt;em&gt;OPTION(MAXRECURSION 102)&lt;/em&gt; after the ORDER BY clause. You can use 0 for unlimited, but be careful. </description>
		<content:encoded><![CDATA[<p>That would be because the default MAXRECURSION is 100. If you want to go above that, add <em>OPTION(MAXRECURSION 102)</em> after the ORDER BY clause. You can use 0 for unlimited, but be careful.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Scott Turner</title>
		<link>http://robboek.com/2009/02/03/fizzbuzz-in-t-sql/comment-page-1/#comment-112</link>
		<dc:creator>Scott Turner</dc:creator>
		<pubDate>Thu, 05 Feb 2009 05:08:20 +0000</pubDate>
		<guid isPermaLink="false">http://robboek.com/?p=95#comment-112</guid>
		<description>Rob, 
 
This also shows another thing. The CTE is recursive in nature. So what we really have here is an example of using recursion. 
 </description>
		<content:encoded><![CDATA[<p>Rob, </p>
<p>This also shows another thing. The CTE is recursive in nature. So what we really have here is an example of using recursion.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Scott Turner</title>
		<link>http://robboek.com/2009/02/03/fizzbuzz-in-t-sql/comment-page-1/#comment-111</link>
		<dc:creator>Scott Turner</dc:creator>
		<pubDate>Thu, 05 Feb 2009 05:01:49 +0000</pubDate>
		<guid isPermaLink="false">http://robboek.com/?p=95#comment-111</guid>
		<description>Rob, 
 
This doesn&#039;t seem to scale well.  
 
When I change the where clause to &quot;WHERE Number &lt; 102&quot;, I get: 
 
&quot;The statement terminated. The maximum recursion 100 has been exhausted before statement completion.&quot; 
 </description>
		<content:encoded><![CDATA[<p>Rob, </p>
<p>This doesn&#039;t seem to scale well.  </p>
<p>When I change the where clause to &quot;WHERE Number &lt; 102&quot;, I get: </p>
<p>&quot;The statement terminated. The maximum recursion 100 has been exhausted before statement completion.&quot;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Rhys</title>
		<link>http://robboek.com/2009/02/03/fizzbuzz-in-t-sql/comment-page-1/#comment-107</link>
		<dc:creator>Rhys</dc:creator>
		<pubDate>Tue, 03 Feb 2009 19:42:47 +0000</pubDate>
		<guid isPermaLink="false">http://robboek.com/?p=95#comment-107</guid>
		<description>This reminds us how hard is is to keep your mind on SET BASED all the time. </description>
		<content:encoded><![CDATA[<p>This reminds us how hard is is to keep your mind on SET BASED all the time.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Pinal Dave</title>
		<link>http://robboek.com/2009/02/03/fizzbuzz-in-t-sql/comment-page-1/#comment-106</link>
		<dc:creator>Pinal Dave</dc:creator>
		<pubDate>Tue, 03 Feb 2009 19:28:25 +0000</pubDate>
		<guid isPermaLink="false">http://robboek.com/?p=95#comment-106</guid>
		<description>Nice </description>
		<content:encoded><![CDATA[<p>Nice</p>
]]></content:encoded>
	</item>
</channel>
</rss>
