<?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; SSMS does NOT Print NULL Values</title>
	<atom:link href="http://blog.sqlauthority.com/2013/03/04/sql-server-ssms-does-not-print-null-values/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.sqlauthority.com/2013/03/04/sql-server-ssms-does-not-print-null-values/</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: Vasan</title>
		<link>http://blog.sqlauthority.com/2013/03/04/sql-server-ssms-does-not-print-null-values/#comment-472627</link>
		<dc:creator><![CDATA[Vasan]]></dc:creator>
		<pubDate>Fri, 10 May 2013 12:14:10 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=22868#comment-472627</guid>
		<description><![CDATA[How about this ?

DECLARE @print NVARCHAR(max)
DECLARE @var1 numeric(10,2),
@var2 numeric(10,2),
@var3 numeric(10,2),
@var4 numeric(10,2)
SET @var1=12500
SET @var2=NULL
SET @var3=500
SELECT @var4=(@var1+@var2+@var3)

SELECT @print= CASE WHEN CAST(@var4 AS VARCHAR(10)) IS NULL THEN &#039;NULL&#039; ELSE CAST(@var4 AS VARCHAR(10)) end

PRINT @print]]></description>
		<content:encoded><![CDATA[<p>How about this ?</p>
<p>DECLARE @print NVARCHAR(max)<br />
DECLARE @var1 numeric(10,2),<br />
@var2 numeric(10,2),<br />
@var3 numeric(10,2),<br />
@var4 numeric(10,2)<br />
SET @var1=12500<br />
SET @var2=NULL<br />
SET @var3=500<br />
SELECT @var4=(@var1+@var2+@var3)</p>
<p>SELECT @print= CASE WHEN CAST(@var4 AS VARCHAR(10)) IS NULL THEN &#8216;NULL&#8217; ELSE CAST(@var4 AS VARCHAR(10)) end</p>
<p>PRINT @print</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Bryan</title>
		<link>http://blog.sqlauthority.com/2013/03/04/sql-server-ssms-does-not-print-null-values/#comment-433427</link>
		<dc:creator><![CDATA[Bryan]]></dc:creator>
		<pubDate>Thu, 07 Mar 2013 14:27:26 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=22868#comment-433427</guid>
		<description><![CDATA[IsNull can also cause a different problem if you aren&#039;t careful though.

declare @var1 int = NULL
           , @var2 varchar(100) = NULL

    print &#039;@var1=&#039; + convert(varchar(100), isNull(@var1, &#039;NULL&#039;)) --will NOT work, and will throw an exception instead.

but 
    print &#039;@var2=&#039; + convert(varchar(100), isNull(@var2, &#039;NULL&#039;)) --WILL work.(and the convert is unnecessary)

Why? because IsNull() converts the second parameter into the type of the first parameter before returning a value and the character string &#039;NULL&#039; does not convert into an int!

the correct form to safely print @var1 when NULLs are possible would be:

    print &#039;@var1=&#039; + isNull(convert(varchar(100), @var1), &#039;NULL&#039;)]]></description>
		<content:encoded><![CDATA[<p>IsNull can also cause a different problem if you aren&#8217;t careful though.</p>
<p>declare @var1 int = NULL<br />
           , @var2 varchar(100) = NULL</p>
<p>    print &#8216;@var1=&#8217; + convert(varchar(100), isNull(@var1, &#8216;NULL&#8217;)) &#8211;will NOT work, and will throw an exception instead.</p>
<p>but<br />
    print &#8216;@var2=&#8217; + convert(varchar(100), isNull(@var2, &#8216;NULL&#8217;)) &#8211;WILL work.(and the convert is unnecessary)</p>
<p>Why? because IsNull() converts the second parameter into the type of the first parameter before returning a value and the character string &#8216;NULL&#8217; does not convert into an int!</p>
<p>the correct form to safely print @var1 when NULLs are possible would be:</p>
<p>    print &#8216;@var1=&#8217; + isNull(convert(varchar(100), @var1), &#8216;NULL&#8217;)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Aaron</title>
		<link>http://blog.sqlauthority.com/2013/03/04/sql-server-ssms-does-not-print-null-values/#comment-432019</link>
		<dc:creator><![CDATA[Aaron]]></dc:creator>
		<pubDate>Tue, 05 Mar 2013 09:17:37 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=22868#comment-432019</guid>
		<description><![CDATA[For SQL Server, ISNULL will work. However, find me an ISNULL in Oracle and you will see the solution I provide is better for this particular problem.

Here is an article which extensively examines this question.

http://www.mssqltips.com/sqlservertip/2689/deciding-between-coalesce-and-isnull-in-sql-server/]]></description>
		<content:encoded><![CDATA[<p>For SQL Server, ISNULL will work. However, find me an ISNULL in Oracle and you will see the solution I provide is better for this particular problem.</p>
<p>Here is an article which extensively examines this question.</p>
<p><a href="http://www.mssqltips.com/sqlservertip/2689/deciding-between-coalesce-and-isnull-in-sql-server/" rel="nofollow">http://www.mssqltips.com/sqlservertip/2689/deciding-between-coalesce-and-isnull-in-sql-server/</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Shuaib</title>
		<link>http://blog.sqlauthority.com/2013/03/04/sql-server-ssms-does-not-print-null-values/#comment-431832</link>
		<dc:creator><![CDATA[Shuaib]]></dc:creator>
		<pubDate>Tue, 05 Mar 2013 02:26:16 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=22868#comment-431832</guid>
		<description><![CDATA[Interesting]]></description>
		<content:encoded><![CDATA[<p>Interesting</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ali Kolahdoozan</title>
		<link>http://blog.sqlauthority.com/2013/03/04/sql-server-ssms-does-not-print-null-values/#comment-431786</link>
		<dc:creator><![CDATA[Ali Kolahdoozan]]></dc:creator>
		<pubDate>Tue, 05 Mar 2013 00:53:00 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=22868#comment-431786</guid>
		<description><![CDATA[ISNULL Dear.Isnull will solve the problem.]]></description>
		<content:encoded><![CDATA[<p>ISNULL Dear.Isnull will solve the problem.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Aaron</title>
		<link>http://blog.sqlauthority.com/2013/03/04/sql-server-ssms-does-not-print-null-values/#comment-431586</link>
		<dc:creator><![CDATA[Aaron]]></dc:creator>
		<pubDate>Mon, 04 Mar 2013 17:18:18 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=22868#comment-431586</guid>
		<description><![CDATA[You would get a printed result if you were to do the following:

SELECT @var4=(coalesce(@var1, 0)+coalesce(@var2, 0)+coalesce(@var3, 0))]]></description>
		<content:encoded><![CDATA[<p>You would get a printed result if you were to do the following:</p>
<p>SELECT @var4=(coalesce(@var1, 0)+coalesce(@var2, 0)+coalesce(@var3, 0))</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Shorty</title>
		<link>http://blog.sqlauthority.com/2013/03/04/sql-server-ssms-does-not-print-null-values/#comment-431495</link>
		<dc:creator><![CDATA[Shorty]]></dc:creator>
		<pubDate>Mon, 04 Mar 2013 14:32:54 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=22868#comment-431495</guid>
		<description><![CDATA[Good hint, thanks ! 
Had this problem myself some time ago when i was concatenating a print string with certain values and it was driving me nuts that there was no reply from SSMS :) - Gonna use &#039;Select&#039; from now on.]]></description>
		<content:encoded><![CDATA[<p>Good hint, thanks !<br />
Had this problem myself some time ago when i was concatenating a print string with certain values and it was driving me nuts that there was no reply from SSMS :) &#8211; Gonna use &#8216;Select&#8217; from now on.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: resender</title>
		<link>http://blog.sqlauthority.com/2013/03/04/sql-server-ssms-does-not-print-null-values/#comment-431494</link>
		<dc:creator><![CDATA[resender]]></dc:creator>
		<pubDate>Mon, 04 Mar 2013 14:31:19 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=22868#comment-431494</guid>
		<description><![CDATA[Interesting so having a null value in the mathematics changes the outcome to null, not sure if its correct logic but interesting non the less]]></description>
		<content:encoded><![CDATA[<p>Interesting so having a null value in the mathematics changes the outcome to null, not sure if its correct logic but interesting non the less</p>
]]></content:encoded>
	</item>
</channel>
</rss>
