<?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: SQL CASE statement with NULLs</title>
	<atom:link href="http://www.stillnetstudios.com/mssql-case-statement-with-nulls/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.stillnetstudios.com/mssql-case-statement-with-nulls/</link>
	<description>Web development notes and commentary from Ryan Stille</description>
	<lastBuildDate>Wed, 01 Feb 2012 10:14:03 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
	<item>
		<title>By: Phil</title>
		<link>http://www.stillnetstudios.com/mssql-case-statement-with-nulls/comment-page-1/#comment-2686</link>
		<dc:creator>Phil</dc:creator>
		<pubDate>Wed, 01 Feb 2012 10:14:03 +0000</pubDate>
		<guid isPermaLink="false">http://www.stillnetstudios.com/2008/06/04/mssql-case-statement-with-nulls/#comment-2686</guid>
		<description>Thanks for this, I was having trouble with NULL values but the &#039;search&#039; method of the CASE statement works just fine.</description>
		<content:encoded><![CDATA[<p>Thanks for this, I was having trouble with NULL values but the &#8216;search&#8217; method of the CASE statement works just fine.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Usman</title>
		<link>http://www.stillnetstudios.com/mssql-case-statement-with-nulls/comment-page-1/#comment-2595</link>
		<dc:creator>Usman</dc:creator>
		<pubDate>Wed, 02 Nov 2011 16:45:27 +0000</pubDate>
		<guid isPermaLink="false">http://www.stillnetstudios.com/2008/06/04/mssql-case-statement-with-nulls/#comment-2595</guid>
		<description>Thanks Buddy. Helped me to get those NULL variables to accept values! My blog on that here:
http://usman-suglatwala.blogspot.com/2011/11/handling-nulls-in-sql-while-inserting.html</description>
		<content:encoded><![CDATA[<p>Thanks Buddy. Helped me to get those NULL variables to accept values! My blog on that here:<br />
<a href="http://usman-suglatwala.blogspot.com/2011/11/handling-nulls-in-sql-while-inserting.html" rel="nofollow">http://usman-suglatwala.blogspot.com/2011/11/handling-nulls-in-sql-while-inserting.html</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Priya</title>
		<link>http://www.stillnetstudios.com/mssql-case-statement-with-nulls/comment-page-1/#comment-2025</link>
		<dc:creator>Priya</dc:creator>
		<pubDate>Mon, 31 Jan 2011 12:11:31 +0000</pubDate>
		<guid isPermaLink="false">http://www.stillnetstudios.com/2008/06/04/mssql-case-statement-with-nulls/#comment-2025</guid>
		<description>Hi Stelban and Kumar,
@ Kumar : Actually, I was in need of not null records.

I have resolved the issue in a simple way by just putting my query in a new select statement. 

select * from (Select NAME, EMPID,
case
when ( LOCATION like &apos;chennai&apos; or LOCATION like &apos;coimbatore&apos;)
then &apos;Tamil Nadu&apos;
when ( LOCATION like &apos;cochin&apos; or LOCATION like &apos;Trivandrum&apos;)
then &apos;Kerala&apos;
else
end STATE
from biodata where EMPID in ( select EMPID from biodata))
where STATE is not null;

This gives the o/p
NAME&#160;&#160;&#160;&#160;EMPID&#160;&#160;&#160;&#160;STATE
Tom&#160;&#160;&#160;&#160;12546&#160;&#160;&#160;&#160;Tamil Nadu
Amy&#160;&#160;&#160;&#160;14645&#160;&#160;&#160;&#160;Kerala
 rather than

The output would be like,

NAME&#160;&#160;&#160;&#160;EMPID&#160;&#160;&#160;&#160;STATE
Tom&#160;&#160;&#160;&#160;12546&#160;&#160;&#160;&#160;Tamil Nadu
Amy&#160;&#160;&#160;&#160;14645&#160;&#160;&#160;&#160;Kerala
Katie&#160;&#160;&#160;&#160;24645&#160;&#160;&#160;&#160;
Ravesh&#160;&#160;&#160;&#160;54654


Hope this helps !!</description>
		<content:encoded><![CDATA[<p>Hi Stelban and Kumar,<br />
@ Kumar : Actually, I was in need of not null records.</p>
<p>I have resolved the issue in a simple way by just putting my query in a new select statement. </p>
<p>select * from (Select NAME, EMPID,<br />
case<br />
when ( LOCATION like &apos;chennai&apos; or LOCATION like &apos;coimbatore&apos;)<br />
then &apos;Tamil Nadu&apos;<br />
when ( LOCATION like &apos;cochin&apos; or LOCATION like &apos;Trivandrum&apos;)<br />
then &apos;Kerala&apos;<br />
else<br />
end STATE<br />
from biodata where EMPID in ( select EMPID from biodata))<br />
where STATE is not null;</p>
<p>This gives the o/p<br />
NAME&nbsp;&nbsp;&nbsp;&nbsp;EMPID&nbsp;&nbsp;&nbsp;&nbsp;STATE<br />
Tom&nbsp;&nbsp;&nbsp;&nbsp;12546&nbsp;&nbsp;&nbsp;&nbsp;Tamil Nadu<br />
Amy&nbsp;&nbsp;&nbsp;&nbsp;14645&nbsp;&nbsp;&nbsp;&nbsp;Kerala<br />
 rather than</p>
<p>The output would be like,</p>
<p>NAME&nbsp;&nbsp;&nbsp;&nbsp;EMPID&nbsp;&nbsp;&nbsp;&nbsp;STATE<br />
Tom&nbsp;&nbsp;&nbsp;&nbsp;12546&nbsp;&nbsp;&nbsp;&nbsp;Tamil Nadu<br />
Amy&nbsp;&nbsp;&nbsp;&nbsp;14645&nbsp;&nbsp;&nbsp;&nbsp;Kerala<br />
Katie&nbsp;&nbsp;&nbsp;&nbsp;24645&nbsp;&nbsp;&nbsp;&nbsp;<br />
Ravesh&nbsp;&nbsp;&nbsp;&nbsp;54654</p>
<p>Hope this helps !!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: kumar</title>
		<link>http://www.stillnetstudios.com/mssql-case-statement-with-nulls/comment-page-1/#comment-1987</link>
		<dc:creator>kumar</dc:creator>
		<pubDate>Wed, 22 Dec 2010 15:52:33 +0000</pubDate>
		<guid isPermaLink="false">http://www.stillnetstudios.com/2008/06/04/mssql-case-statement-with-nulls/#comment-1987</guid>
		<description>use ISNULL(columnName,&lt;What ever you want if the value is NULL&gt;)

Hope this helps...</description>
		<content:encoded><![CDATA[<p>use ISNULL(columnName,&lt;What ever you want if the value is NULL&gt;)</p>
<p>Hope this helps&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: stelban</title>
		<link>http://www.stillnetstudios.com/mssql-case-statement-with-nulls/comment-page-1/#comment-1864</link>
		<dc:creator>stelban</dc:creator>
		<pubDate>Fri, 29 Oct 2010 17:46:29 +0000</pubDate>
		<guid isPermaLink="false">http://www.stillnetstudios.com/2008/06/04/mssql-case-statement-with-nulls/#comment-1864</guid>
		<description>Nice trick using nulls with case statement.&#160;&#160;Very helpful!&#160;&#160;Thanks</description>
		<content:encoded><![CDATA[<p>Nice trick using nulls with case statement.&nbsp;&nbsp;Very helpful!&nbsp;&nbsp;Thanks</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Priya</title>
		<link>http://www.stillnetstudios.com/mssql-case-statement-with-nulls/comment-page-1/#comment-1674</link>
		<dc:creator>Priya</dc:creator>
		<pubDate>Tue, 07 Sep 2010 13:51:08 +0000</pubDate>
		<guid isPermaLink="false">http://www.stillnetstudios.com/2008/06/04/mssql-case-statement-with-nulls/#comment-1674</guid>
		<description>The output would be like,

NAME&#160;&#160;&#160;&#160;EMPID&#160;&#160;&#160;&#160;STATE
Tom&#160;&#160;&#160;&#160;12546&#160;&#160;&#160;&#160;Tamil Nadu
Amy&#160;&#160;&#160;&#160;14645&#160;&#160;&#160;&#160;Kerala
Katie&#160;&#160;&#160;&#160;24645&#160;&#160;&#160;&#160;
Ravesh&#160;&#160;&#160;&#160;54654&#160;&#160;&#160;&#160;

I need only not null state records.Please do the needful. Iam facing the issue in my project</description>
		<content:encoded><![CDATA[<p>The output would be like,</p>
<p>NAME&nbsp;&nbsp;&nbsp;&nbsp;EMPID&nbsp;&nbsp;&nbsp;&nbsp;STATE<br />
Tom&nbsp;&nbsp;&nbsp;&nbsp;12546&nbsp;&nbsp;&nbsp;&nbsp;Tamil Nadu<br />
Amy&nbsp;&nbsp;&nbsp;&nbsp;14645&nbsp;&nbsp;&nbsp;&nbsp;Kerala<br />
Katie&nbsp;&nbsp;&nbsp;&nbsp;24645&nbsp;&nbsp;&nbsp;&nbsp;<br />
Ravesh&nbsp;&nbsp;&nbsp;&nbsp;54654&nbsp;&nbsp;&nbsp;&nbsp;</p>
<p>I need only not null state records.Please do the needful. Iam facing the issue in my project</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Priya</title>
		<link>http://www.stillnetstudios.com/mssql-case-statement-with-nulls/comment-page-1/#comment-1673</link>
		<dc:creator>Priya</dc:creator>
		<pubDate>Tue, 07 Sep 2010 12:55:56 +0000</pubDate>
		<guid isPermaLink="false">http://www.stillnetstudios.com/2008/06/04/mssql-case-statement-with-nulls/#comment-1673</guid>
		<description>I have a similar issue. I do not wanna display the NULL records hitting the 
else part.For eg .I tried out methods like 

Select NAME, EMPID,
case 
when ( LOCATION like &apos;chennai&apos; or LOCATION like &apos;coimbatore&apos;)
then &apos;Tamil Nadu&apos;
when ( LOCATION like &apos;cochin&apos; or LOCATION like &apos;Trivandrum&apos;)
then &apos;Kerala&apos;
else
end STATE
from biodata where EMPID in ( select EMPID from biodata)
and STATE is not null;

But iam getting displayed with null STATE records. Please help.</description>
		<content:encoded><![CDATA[<p>I have a similar issue. I do not wanna display the NULL records hitting the<br />
else part.For eg .I tried out methods like </p>
<p>Select NAME, EMPID,<br />
case<br />
when ( LOCATION like &apos;chennai&apos; or LOCATION like &apos;coimbatore&apos;)<br />
then &apos;Tamil Nadu&apos;<br />
when ( LOCATION like &apos;cochin&apos; or LOCATION like &apos;Trivandrum&apos;)<br />
then &apos;Kerala&apos;<br />
else<br />
end STATE<br />
from biodata where EMPID in ( select EMPID from biodata)<br />
and STATE is not null;</p>
<p>But iam getting displayed with null STATE records. Please help.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Patel Pinakin</title>
		<link>http://www.stillnetstudios.com/mssql-case-statement-with-nulls/comment-page-1/#comment-1249</link>
		<dc:creator>Patel Pinakin</dc:creator>
		<pubDate>Sat, 03 Apr 2010 07:08:22 +0000</pubDate>
		<guid isPermaLink="false">http://www.stillnetstudios.com/2008/06/04/mssql-case-statement-with-nulls/#comment-1249</guid>
		<description>was just forgot the syntax,
thanx
u helped me recall...

keep posting...</description>
		<content:encoded><![CDATA[<p>was just forgot the syntax,<br />
thanx<br />
u helped me recall&#8230;</p>
<p>keep posting&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Nayha</title>
		<link>http://www.stillnetstudios.com/mssql-case-statement-with-nulls/comment-page-1/#comment-724</link>
		<dc:creator>Nayha</dc:creator>
		<pubDate>Tue, 15 Sep 2009 11:18:18 +0000</pubDate>
		<guid isPermaLink="false">http://www.stillnetstudios.com/2008/06/04/mssql-case-statement-with-nulls/#comment-724</guid>
		<description>very helpful. Thanks.</description>
		<content:encoded><![CDATA[<p>very helpful. Thanks.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mmark</title>
		<link>http://www.stillnetstudios.com/mssql-case-statement-with-nulls/comment-page-1/#comment-382</link>
		<dc:creator>Mmark</dc:creator>
		<pubDate>Thu, 19 Feb 2009 02:39:49 +0000</pubDate>
		<guid isPermaLink="false">http://www.stillnetstudios.com/2008/06/04/mssql-case-statement-with-nulls/#comment-382</guid>
		<description>One more thnak you. It was a big helping.</description>
		<content:encoded><![CDATA[<p>One more thnak you. It was a big helping.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

