<?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>IIF &#8211; Database Research &amp; Development</title>
	<atom:link href="https://www.dbrnd.com/tag/iif/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.dbrnd.com</link>
	<description>BIGData &#124; NoSQL &#124; MSSQL &#124; MySQL &#124; PostgreSQL</description>
	<lastBuildDate>Tue, 19 Sep 2017 06:57:05 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=7.0.4</generator>
	<item>
		<title>SQL Server: 2012 Introduce New Logical Function &#8211; IIF</title>
		<link>https://www.dbrnd.com/2015/12/sql-server-2012-introduce-new-logical-fuction-iif/</link>
					<comments>https://www.dbrnd.com/2015/12/sql-server-2012-introduce-new-logical-fuction-iif/#comments</comments>
		
		<dc:creator><![CDATA[Anvesh Patel]]></dc:creator>
		<pubDate>Tue, 29 Dec 2015 17:04:37 +0000</pubDate>
				<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[Anvesh Patel]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[database research and development]]></category>
		<category><![CDATA[dbrnd]]></category>
		<category><![CDATA[IIF]]></category>
		<category><![CDATA[SQL Query]]></category>
		<category><![CDATA[SQL Server 2012]]></category>
		<category><![CDATA[SQL Server Administrator]]></category>
		<category><![CDATA[SQL Server Monitoring]]></category>
		<category><![CDATA[SQL Server Performance Tunning]]></category>
		<category><![CDATA[SQL Server Tips and Tricks]]></category>
		<category><![CDATA[TSQL]]></category>
		<guid isPermaLink="false">https://www.dbrnd.com/?p=1174</guid>

					<description><![CDATA[SQL Server 2012 introduced a new logical function called &#8220;IIF&#8221; and here, I am going to share basic syntax and use of this function. The primary purpose of this function is to check the Boolean condition. If the condition is true, it returns a true value. Otherwise, it returns the false value. Using this function, [&#8230;]]]></description>
										<content:encoded><![CDATA[<p><a class="a2a_button_facebook" href="https://www.addtoany.com/add_to/facebook?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2015%2F12%2Fsql-server-2012-introduce-new-logical-fuction-iif%2F&amp;linkname=SQL%20Server%3A%202012%20Introduce%20New%20Logical%20Function%20%E2%80%93%20IIF" title="Facebook" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_twitter" href="https://www.addtoany.com/add_to/twitter?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2015%2F12%2Fsql-server-2012-introduce-new-logical-fuction-iif%2F&amp;linkname=SQL%20Server%3A%202012%20Introduce%20New%20Logical%20Function%20%E2%80%93%20IIF" title="Twitter" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_linkedin" href="https://www.addtoany.com/add_to/linkedin?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2015%2F12%2Fsql-server-2012-introduce-new-logical-fuction-iif%2F&amp;linkname=SQL%20Server%3A%202012%20Introduce%20New%20Logical%20Function%20%E2%80%93%20IIF" title="LinkedIn" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_pinterest" href="https://www.addtoany.com/add_to/pinterest?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2015%2F12%2Fsql-server-2012-introduce-new-logical-fuction-iif%2F&amp;linkname=SQL%20Server%3A%202012%20Introduce%20New%20Logical%20Function%20%E2%80%93%20IIF" title="Pinterest" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_reddit" href="https://www.addtoany.com/add_to/reddit?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2015%2F12%2Fsql-server-2012-introduce-new-logical-fuction-iif%2F&amp;linkname=SQL%20Server%3A%202012%20Introduce%20New%20Logical%20Function%20%E2%80%93%20IIF" title="Reddit" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_pocket" href="https://www.addtoany.com/add_to/pocket?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2015%2F12%2Fsql-server-2012-introduce-new-logical-fuction-iif%2F&amp;linkname=SQL%20Server%3A%202012%20Introduce%20New%20Logical%20Function%20%E2%80%93%20IIF" title="Pocket" rel="nofollow noopener" target="_blank"></a><a class="a2a_dd addtoany_share_save addtoany_share" href="https://www.addtoany.com/share#url=https%3A%2F%2Fwww.dbrnd.com%2F2015%2F12%2Fsql-server-2012-introduce-new-logical-fuction-iif%2F&#038;title=SQL%20Server%3A%202012%20Introduce%20New%20Logical%20Function%20%E2%80%93%20IIF" data-a2a-url="https://www.dbrnd.com/2015/12/sql-server-2012-introduce-new-logical-fuction-iif/" data-a2a-title="SQL Server: 2012 Introduce New Logical Function – IIF"></a></p><p>SQL Server 2012 introduced a new logical function called &#8220;IIF&#8221; and here, I am going to share basic syntax and use of this function.</p>
<p>The primary purpose of this function is to check the Boolean condition. If the condition is true, it returns a true value. Otherwise, it returns the false value.</p>
<p>Using this function, you can validate and return value in a single line of code and don&#8217;t require to use IF-ELSE.</p>
<p><strong>The Syntax of IIF:</strong><br />
<pre class="crayon-plain-tag">IIF ( boolean_expression, true_value, false_value )</pre>
<p><strong>Example ONE:</strong><br />
<pre class="crayon-plain-tag">DECLARE @no1 int = 808;
DECLARE @no2 int = 1600;
SELECT IIF ( @no1 &gt; @no2, 'TRUE', 'FALSE' ) AS Result;

Result
-------
FALSE</pre>
<p><strong>Example TWO:</strong><br />
<pre class="crayon-plain-tag">DECLARE @no1 int = 808;
DECLARE @no2 int = 1600;
SELECT IIF ( @no1 &gt; @no2, NULL, NULL ) AS Result;

--Result: Error (Both NULL constant is not allowed)</pre>
<p><strong>Example THREE:</strong><br />
<pre class="crayon-plain-tag">DECLARE @no1 int = 808;
DECLARE @no2 int = 1600;
SELECT IIF ( @no1 &gt; @no2, NULL, 'Else' ) AS Result;

Result
------
Else</pre>
<p><strong>Example of Nested IIF:</strong><br />
<pre class="crayon-plain-tag">DECLARE @Score int = 88;
SELECT IIF ( @Score&gt; 90, 'A Grade', IIF(@Score&gt;=80 And @Score&lt;=90,'B Grade','C Grade')) AS Result;

Result
-------
B Grade</pre>
]]></content:encoded>
					
					<wfw:commentRss>https://www.dbrnd.com/2015/12/sql-server-2012-introduce-new-logical-fuction-iif/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
			</item>
	</channel>
</rss>
