<?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; T-SQL Script for FizzBuzz Logic</title>
	<atom:link href="http://blog.sqlauthority.com/2009/02/02/sql-server-t-sql-script-for-fizzbuzz-logic/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.sqlauthority.com/2009/02/02/sql-server-t-sql-script-for-fizzbuzz-logic/</link>
	<description>Personal Notes of Pinal Dave</description>
	<lastBuildDate>Fri, 17 May 2013 15:26:57 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
	<item>
		<title>By: Keith</title>
		<link>http://blog.sqlauthority.com/2009/02/02/sql-server-t-sql-script-for-fizzbuzz-logic/#comment-471940</link>
		<dc:creator><![CDATA[Keith]]></dc:creator>
		<pubDate>Thu, 09 May 2013 11:41:34 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=2233#comment-471940</guid>
		<description><![CDATA[A pure SQL solution without a need for loops, etc, which is also pretty portable between different flavours of SQL.

SELECT
 CASE
 WHEN (a.i + b.i * 10 + 1)% 3 = 0 AND (a.i + b.i * 10 + 1)% 5 = 0 THEN ‘Fizz Buzz’
 WHEN (a.i + b.i * 10 + 1)% 3 = 0 THEN ‘Fizz’
 WHEN (a.i + b.i * 10 + 1)% 5 = 0 THEN ‘Buzz’
 ELSE CONVERT(varchar, (a.i + b.i * 10 + 1 ))
 END AS FizzBuzz
 FROM (SELECT 0 AS i UNION SELECT 1 UNION SELECT 2 UNION SELECT 3 UNION SELECT 4 UNION SELECT 5 UNION SELECT 6 UNION SELECT 7 UNION SELECT 8 UNION SELECT 9) a,
 (SELECT 0 AS i UNION SELECT 1 UNION SELECT 2 UNION SELECT 3 UNION SELECT 4 UNION SELECT 5 UNION SELECT 6 UNION SELECT 7 UNION SELECT 8 UNION SELECT 9) b
 ORDER BY a.i + b.i * 10 + 1]]></description>
		<content:encoded><![CDATA[<p>A pure SQL solution without a need for loops, etc, which is also pretty portable between different flavours of SQL.</p>
<p>SELECT<br />
 CASE<br />
 WHEN (a.i + b.i * 10 + 1)% 3 = 0 AND (a.i + b.i * 10 + 1)% 5 = 0 THEN ‘Fizz Buzz’<br />
 WHEN (a.i + b.i * 10 + 1)% 3 = 0 THEN ‘Fizz’<br />
 WHEN (a.i + b.i * 10 + 1)% 5 = 0 THEN ‘Buzz’<br />
 ELSE CONVERT(varchar, (a.i + b.i * 10 + 1 ))<br />
 END AS FizzBuzz<br />
 FROM (SELECT 0 AS i UNION SELECT 1 UNION SELECT 2 UNION SELECT 3 UNION SELECT 4 UNION SELECT 5 UNION SELECT 6 UNION SELECT 7 UNION SELECT 8 UNION SELECT 9) a,<br />
 (SELECT 0 AS i UNION SELECT 1 UNION SELECT 2 UNION SELECT 3 UNION SELECT 4 UNION SELECT 5 UNION SELECT 6 UNION SELECT 7 UNION SELECT 8 UNION SELECT 9) b<br />
 ORDER BY a.i + b.i * 10 + 1</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: SQL SERVER &#8211; Weekly Series &#8211; Memory Lane &#8211; #014 &#171; SQL Server Journey with SQL Authority</title>
		<link>http://blog.sqlauthority.com/2009/02/02/sql-server-t-sql-script-for-fizzbuzz-logic/#comment-416520</link>
		<dc:creator><![CDATA[SQL SERVER &#8211; Weekly Series &#8211; Memory Lane &#8211; #014 &#171; SQL Server Journey with SQL Authority]]></dc:creator>
		<pubDate>Sat, 02 Feb 2013 01:30:58 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=2233#comment-416520</guid>
		<description><![CDATA[[...] SQL SERVER – T-SQL Script for FizzBuzz Logic Write a program that prints the numbers from 1 to 100. But for multiples of three print “Fizz” instead of the number and for the multiples of five print “Buzz”. For numbers which are multiples of both three and five print “FizzBuzz”. Now try to resolve it yourself or read my solution in the blog post. [...]]]></description>
		<content:encoded><![CDATA[<p>[...] SQL SERVER – T-SQL Script for FizzBuzz Logic Write a program that prints the numbers from 1 to 100. But for multiples of three print “Fizz” instead of the number and for the multiples of five print “Buzz”. For numbers which are multiples of both three and five print “FizzBuzz”. Now try to resolve it yourself or read my solution in the blog post. [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Eelco</title>
		<link>http://blog.sqlauthority.com/2009/02/02/sql-server-t-sql-script-for-fizzbuzz-logic/#comment-260364</link>
		<dc:creator><![CDATA[Eelco]]></dc:creator>
		<pubDate>Wed, 07 Mar 2012 11:53:36 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=2233#comment-260364</guid>
		<description><![CDATA[declare @intCount integer =1
 , @Buzz varchar(15) = &#039;&#039;
WHILE @intCount &lt;101

BEGIN
SELECT @Buzz = CASE WHEN (@intCount % 3 = 0 AND @intCount % 5 = 0) THEN &#039;FizzBuzz&#039; 
WHEN @intCount % 5 = 0 then &#039;Buzz&#039; 
WHEN @intCount % 3 = 0 THEN &#039;Fizz&#039; 
ELSE convert(varchar(4),@intCount) END

PRINT @Buzz
SET @intCount=@intCount +1

END]]></description>
		<content:encoded><![CDATA[<p>declare @intCount integer =1<br />
 , @Buzz varchar(15) = &#8221;<br />
WHILE @intCount &lt;101</p>
<p>BEGIN<br />
SELECT @Buzz = CASE WHEN (@intCount % 3 = 0 AND @intCount % 5 = 0) THEN &#039;FizzBuzz&#039;<br />
WHEN @intCount % 5 = 0 then &#039;Buzz&#039;<br />
WHEN @intCount % 3 = 0 THEN &#039;Fizz&#039;<br />
ELSE convert(varchar(4),@intCount) END</p>
<p>PRINT @Buzz<br />
SET @intCount=@intCount +1</p>
<p>END</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Madhivanan</title>
		<link>http://blog.sqlauthority.com/2009/02/02/sql-server-t-sql-script-for-fizzbuzz-logic/#comment-60996</link>
		<dc:creator><![CDATA[Madhivanan]]></dc:creator>
		<pubDate>Thu, 11 Feb 2010 07:49:26 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=2233#comment-60996</guid>
		<description><![CDATA[Another method

select 
	case when number%15=0 then &#039;FrizzBuzz&#039; 
	when number%3=0 then &#039;Friz&#039; when number%5=0 then &#039;Buzz&#039; 
	else cast( number as varchar(10)) end 
from master..spt_values
where type=&#039;p&#039; and number&gt;0

Madhivanan]]></description>
		<content:encoded><![CDATA[<p>Another method</p>
<p>select<br />
	case when number%15=0 then &#8216;FrizzBuzz&#8217;<br />
	when number%3=0 then &#8216;Friz&#8217; when number%5=0 then &#8216;Buzz&#8217;<br />
	else cast( number as varchar(10)) end<br />
from master..spt_values<br />
where type=&#8217;p&#8217; and number&gt;0</p>
<p>Madhivanan</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ibrahim E M</title>
		<link>http://blog.sqlauthority.com/2009/02/02/sql-server-t-sql-script-for-fizzbuzz-logic/#comment-55076</link>
		<dc:creator><![CDATA[Ibrahim E M]]></dc:creator>
		<pubDate>Fri, 21 Aug 2009 05:14:20 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=2233#comment-55076</guid>
		<description><![CDATA[with FIZZBUZZ(a ,b)
AS
(
	select 1 a,cast(1 as nvarchar(10))b
	union all
	select	a+1 ,
			(case	when ((a+1)%3)=0 and ((a+1)%5)=0 then &#039;FIZZBUZZ&#039; 
					when ((a+1)%3)=0 then &#039;FIZZ&#039; 
					when ((a+1)%5)=0 then &#039;BUZZ&#039; 
					else cast(a+1 as nvarchar(10))end) as b from FIZZBUZZ
	where a&lt;100
)
select * from FIZZBUZZ]]></description>
		<content:encoded><![CDATA[<p>with FIZZBUZZ(a ,b)<br />
AS<br />
(<br />
	select 1 a,cast(1 as nvarchar(10))b<br />
	union all<br />
	select	a+1 ,<br />
			(case	when ((a+1)%3)=0 and ((a+1)%5)=0 then &#8216;FIZZBUZZ&#8217;<br />
					when ((a+1)%3)=0 then &#8216;FIZZ&#8217;<br />
					when ((a+1)%5)=0 then &#8216;BUZZ&#8217;<br />
					else cast(a+1 as nvarchar(10))end) as b from FIZZBUZZ<br />
	where a&lt;100<br />
)<br />
select * from FIZZBUZZ</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Atin Srivastava</title>
		<link>http://blog.sqlauthority.com/2009/02/02/sql-server-t-sql-script-for-fizzbuzz-logic/#comment-54456</link>
		<dc:creator><![CDATA[Atin Srivastava]]></dc:creator>
		<pubDate>Wed, 05 Aug 2009 07:35:58 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=2233#comment-54456</guid>
		<description><![CDATA[Little complicated but again thats also a way

declare @st int
declare @en int

set @st=1
set @en=100
while @st&lt;@en
Begin
if (@st%3=0) AND (@st%5=0 )
begin
	Print &#039;FIZZBUZZ&#039;
end
else
begin
	if @st%3=0 
		begin
			PRint &#039;FIZZ&#039;
		end
	else
		Begin
			if @st%5=0 
				begin
					Print &#039;BUZZ&#039;
				end
			Else
				begin
					Print @st
				end
		End
end
set @st=@st+1
end]]></description>
		<content:encoded><![CDATA[<p>Little complicated but again thats also a way</p>
<p>declare @st int<br />
declare @en int</p>
<p>set @st=1<br />
set @en=100<br />
while @st&lt;@en<br />
Begin<br />
if (@st%3=0) AND (@st%5=0 )<br />
begin<br />
	Print &#039;FIZZBUZZ&#039;<br />
end<br />
else<br />
begin<br />
	if @st%3=0<br />
		begin<br />
			PRint &#039;FIZZ&#039;<br />
		end<br />
	else<br />
		Begin<br />
			if @st%5=0<br />
				begin<br />
					Print &#039;BUZZ&#039;<br />
				end<br />
			Else<br />
				begin<br />
					Print @st<br />
				end<br />
		End<br />
end<br />
set @st=@st+1<br />
end</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: VI.jay</title>
		<link>http://blog.sqlauthority.com/2009/02/02/sql-server-t-sql-script-for-fizzbuzz-logic/#comment-53121</link>
		<dc:creator><![CDATA[VI.jay]]></dc:creator>
		<pubDate>Fri, 19 Jun 2009 21:55:26 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=2233#comment-53121</guid>
		<description><![CDATA[I&#039;m not sure if you have any time limit on these posts....


WITH cte (x, y, z) AS
(
  SELECT 0 x, 
               &#039;    &#039; y, 
               &#039;    &#039; z
  UNION ALL
  SELECT x+1, 
         CASE WHEN ((x+1)%3 = 0) THEN &#039;Fizz&#039; ELSE NULL END, 
         CASE WHEN ((x+1)%5 = 0) THEN &#039;Buzz&#039; ELSE NULL END 
  FROM cte WHERE x  0]]></description>
		<content:encoded><![CDATA[<p>I&#8217;m not sure if you have any time limit on these posts&#8230;.</p>
<p>WITH cte (x, y, z) AS<br />
(<br />
  SELECT 0 x,<br />
               &#8216;    &#8216; y,<br />
               &#8216;    &#8216; z<br />
  UNION ALL<br />
  SELECT x+1,<br />
         CASE WHEN ((x+1)%3 = 0) THEN &#8216;Fizz&#8217; ELSE NULL END,<br />
         CASE WHEN ((x+1)%5 = 0) THEN &#8216;Buzz&#8217; ELSE NULL END<br />
  FROM cte WHERE x  0</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Brian Tkatch</title>
		<link>http://blog.sqlauthority.com/2009/02/02/sql-server-t-sql-script-for-fizzbuzz-logic/#comment-49562</link>
		<dc:creator><![CDATA[Brian Tkatch]]></dc:creator>
		<pubDate>Fri, 20 Mar 2009 14:03:57 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=2233#comment-49562</guid>
		<description><![CDATA[Pinal, thanx.

The query did not seem to come through well. Here it is again:

WITH
	Number
AS
(
 SELECT 1 A UNION ALL
 SELECT A + 1 FROM Number WHERE A  0 AND A%5 &gt; 0 THEN CAST(A AS VARCHAR) ELSE &#039;&#039; END
FROM
	Number;]]></description>
		<content:encoded><![CDATA[<p>Pinal, thanx.</p>
<p>The query did not seem to come through well. Here it is again:</p>
<p>WITH<br />
	Number<br />
AS<br />
(<br />
 SELECT 1 A UNION ALL<br />
 SELECT A + 1 FROM Number WHERE A  0 AND A%5 &gt; 0 THEN CAST(A AS VARCHAR) ELSE &#8221; END<br />
FROM<br />
	Number;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: pinaldave</title>
		<link>http://blog.sqlauthority.com/2009/02/02/sql-server-t-sql-script-for-fizzbuzz-logic/#comment-49510</link>
		<dc:creator><![CDATA[pinaldave]]></dc:creator>
		<pubDate>Thu, 19 Mar 2009 19:52:01 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=2233#comment-49510</guid>
		<description><![CDATA[Brian Tkatch NICE!]]></description>
		<content:encoded><![CDATA[<p>Brian Tkatch NICE!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Brian Tkatch</title>
		<link>http://blog.sqlauthority.com/2009/02/02/sql-server-t-sql-script-for-fizzbuzz-logic/#comment-49509</link>
		<dc:creator><![CDATA[Brian Tkatch]]></dc:creator>
		<pubDate>Thu, 19 Mar 2009 19:04:02 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=2233#comment-49509</guid>
		<description><![CDATA[Here&#039;s another qay, very similar to howyue:

WITH
	Number
AS
	(
	 SELECT 1 A UNION ALL
	 SELECT A + 1 FROM Number WHERE A  0 AND A%5 &gt; 0 THEN CAST(A AS VARCHAR) ELSE &#039;&#039; END
FROM
		Number;]]></description>
		<content:encoded><![CDATA[<p>Here&#8217;s another qay, very similar to howyue:</p>
<p>WITH<br />
	Number<br />
AS<br />
	(<br />
	 SELECT 1 A UNION ALL<br />
	 SELECT A + 1 FROM Number WHERE A  0 AND A%5 &gt; 0 THEN CAST(A AS VARCHAR) ELSE &#8221; END<br />
FROM<br />
		Number;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Rakesh Varma</title>
		<link>http://blog.sqlauthority.com/2009/02/02/sql-server-t-sql-script-for-fizzbuzz-logic/#comment-49487</link>
		<dc:creator><![CDATA[Rakesh Varma]]></dc:creator>
		<pubDate>Thu, 19 Mar 2009 13:06:09 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=2233#comment-49487</guid>
		<description><![CDATA[Declare @num as int 
set @num = 1 
while @num &lt;= 100
Begin
  if(@num%15=0)
      print &#039;FizzBuzz&#039;
  else if(@num%5=0)
      print &#039;Buzz&#039;
  else if(@num%3=0)
      print &#039;Fizz&#039;
  else
      print @num
set @num=@num+1;
end]]></description>
		<content:encoded><![CDATA[<p>Declare @num as int<br />
set @num = 1<br />
while @num &lt;= 100<br />
Begin<br />
  if(@num%15=0)<br />
      print &#8216;FizzBuzz&#8217;<br />
  else if(@num%5=0)<br />
      print &#8216;Buzz&#8217;<br />
  else if(@num%3=0)<br />
      print &#8216;Fizz&#8217;<br />
  else<br />
      print @num<br />
set @num=@num+1;<br />
end</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: sinshith.S</title>
		<link>http://blog.sqlauthority.com/2009/02/02/sql-server-t-sql-script-for-fizzbuzz-logic/#comment-46917</link>
		<dc:creator><![CDATA[sinshith.S]]></dc:creator>
		<pubDate>Thu, 19 Feb 2009 13:48:58 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=2233#comment-46917</guid>
		<description><![CDATA[declare @v1 varchar(100)
declare @v2 varchar(100)
select @v1=0
while (@v1&lt;100)
begin
select @v1=@v1+1
--select @v2=((@v1%3)=0 and (@v1%5)=0)
if ((@v1%3=0) and (@v1%5=0))
print &#039;fizzbuzz&#039;
if(@v1%3)=0
print &#039;fizz&#039;
else 
if(@v1%5)=0
print &#039;buzz&#039;
else 
print @v1
end]]></description>
		<content:encoded><![CDATA[<p>declare @v1 varchar(100)<br />
declare @v2 varchar(100)<br />
select @v1=0<br />
while (@v1&lt;100)<br />
begin<br />
select @v1=@v1+1<br />
&#8211;select @v2=((@v1%3)=0 and (@v1%5)=0)<br />
if ((@v1%3=0) and (@v1%5=0))<br />
print &#8216;fizzbuzz&#8217;<br />
if(@v1%3)=0<br />
print &#8216;fizz&#8217;<br />
else<br />
if(@v1%5)=0<br />
print &#8216;buzz&#8217;<br />
else<br />
print @v1<br />
end</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: howyue</title>
		<link>http://blog.sqlauthority.com/2009/02/02/sql-server-t-sql-script-for-fizzbuzz-logic/#comment-46269</link>
		<dc:creator><![CDATA[howyue]]></dc:creator>
		<pubDate>Tue, 03 Feb 2009 05:25:07 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=2233#comment-46269</guid>
		<description><![CDATA[since we gonna do it in sql server, i suppose the result would be better to display in table:

WITH CTE (Col1)
AS
(
	SELECT 1 AS Col1
	UNION ALL
	SELECT Col1 + 1 FROM CTE
	WHERE Col1 &lt; 100
)
SELECT 
	CASE 
		WHEN Col1%3 = 0 AND Col1%5 = 0 THEN &#039;FizzBuzz&#039;
		WHEN Col1%3 = 0 THEN &#039;Fizz&#039;
		WHEN COl1%5 = 0 THEN &#039;Buzz&#039;
		ELSE CONVERT(VARCHAR(3), Col1)
	END
FROM CTE]]></description>
		<content:encoded><![CDATA[<p>since we gonna do it in sql server, i suppose the result would be better to display in table:</p>
<p>WITH CTE (Col1)<br />
AS<br />
(<br />
	SELECT 1 AS Col1<br />
	UNION ALL<br />
	SELECT Col1 + 1 FROM CTE<br />
	WHERE Col1 &lt; 100<br />
)<br />
SELECT<br />
	CASE<br />
		WHEN Col1%3 = 0 AND Col1%5 = 0 THEN &#8216;FizzBuzz&#8217;<br />
		WHEN Col1%3 = 0 THEN &#8216;Fizz&#8217;<br />
		WHEN COl1%5 = 0 THEN &#8216;Buzz&#8217;<br />
		ELSE CONVERT(VARCHAR(3), Col1)<br />
	END<br />
FROM CTE</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ronald</title>
		<link>http://blog.sqlauthority.com/2009/02/02/sql-server-t-sql-script-for-fizzbuzz-logic/#comment-46233</link>
		<dc:creator><![CDATA[Ronald]]></dc:creator>
		<pubDate>Mon, 02 Feb 2009 09:37:42 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=2233#comment-46233</guid>
		<description><![CDATA[Following code maybe a little bit dummy but seems more readable?

DECLARE @counter varchar(5)
SET @counter = 1
WHILE @counter &lt; 101
BEGIN

print case
when @counter%3=0 and @counter %5 !=0 then &#039;Fizz&#039;
when @counter %3 !=0 and @counter%5=0 then &#039;Buzz&#039;
when @counter%3=0 and @counter%5=0 then &#039;FizzBuzz&#039;
 else @counter end

SET @counter = @counter + 1

END]]></description>
		<content:encoded><![CDATA[<p>Following code maybe a little bit dummy but seems more readable?</p>
<p>DECLARE @counter varchar(5)<br />
SET @counter = 1<br />
WHILE @counter &lt; 101<br />
BEGIN</p>
<p>print case<br />
when @counter%3=0 and @counter %5 !=0 then &#8216;Fizz&#8217;<br />
when @counter %3 !=0 and @counter%5=0 then &#8216;Buzz&#8217;<br />
when @counter%3=0 and @counter%5=0 then &#8216;FizzBuzz&#8217;<br />
 else @counter end</p>
<p>SET @counter = @counter + 1</p>
<p>END</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: pinaldave</title>
		<link>http://blog.sqlauthority.com/2009/02/02/sql-server-t-sql-script-for-fizzbuzz-logic/#comment-46224</link>
		<dc:creator><![CDATA[pinaldave]]></dc:creator>
		<pubDate>Mon, 02 Feb 2009 07:21:33 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=2233#comment-46224</guid>
		<description><![CDATA[Zod,

Good Script. Let us see what else we get from other exports.

Kind Regards,
Pinal]]></description>
		<content:encoded><![CDATA[<p>Zod,</p>
<p>Good Script. Let us see what else we get from other exports.</p>
<p>Kind Regards,<br />
Pinal</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Zod</title>
		<link>http://blog.sqlauthority.com/2009/02/02/sql-server-t-sql-script-for-fizzbuzz-logic/#comment-46223</link>
		<dc:creator><![CDATA[Zod]]></dc:creator>
		<pubDate>Mon, 02 Feb 2009 07:17:37 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=2233#comment-46223</guid>
		<description><![CDATA[I would take a set-based approach:





CREATE TABLE ##nums
(
	number int IDENTITY(1,1),
	nothing int null
)

INSERT ##nums (nothing)
SELECT TOP(100) OBJECT_ID FROM sys.all_columns  


SELECT &#039;FizzBuzz&#039; = 
      CASE 
         WHEN ((number % 3 = 0) AND (number % 5 = 0)) THEN &#039;FizzBuzz&#039;
         WHEN (number % 5 = 0) THEN &#039;Buzz&#039;
         WHEN (number % 3 = 0) THEN &#039;Fizz&#039;
         ELSE CAST(number AS CHAR(3))         
      END
FROM ##nums 

]]></description>
		<content:encoded><![CDATA[<p>I would take a set-based approach:</p>
<p>CREATE TABLE ##nums<br />
(<br />
	number int IDENTITY(1,1),<br />
	nothing int null<br />
)</p>
<p>INSERT ##nums (nothing)<br />
SELECT TOP(100) OBJECT_ID FROM sys.all_columns  </p>
<p>SELECT &#8216;FizzBuzz&#8217; =<br />
      CASE<br />
         WHEN ((number % 3 = 0) AND (number % 5 = 0)) THEN &#8216;FizzBuzz&#8217;<br />
         WHEN (number % 5 = 0) THEN &#8216;Buzz&#8217;<br />
         WHEN (number % 3 = 0) THEN &#8216;Fizz&#8217;<br />
         ELSE CAST(number AS CHAR(3))<br />
      END<br />
FROM ##nums </p>
]]></content:encoded>
	</item>
</channel>
</rss>
