﻿<?xml version='1.0' encoding='UTF-8'?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>SQLServerCentral / Discuss Content Posted by James Travis / Article Discussions / Article Discussions by Author  / ISNull Not working / Latest Posts</title><generator>InstantForum.NET v2.9.0</generator><description>SQLServerCentral</description><link>http://www.sqlservercentral.com/Forums/</link><webMaster>notifications@sqlservercentral.com</webMaster><lastBuildDate>Mon, 20 May 2013 13:16:21 GMT</lastBuildDate><ttl>20</ttl><item><title>RE: ISNull Not working</title><link>http://www.sqlservercentral.com/Forums/Topic812342-80-1.aspx</link><description>[quote][b]Faye Fouladi (7/21/2011)[/b][hr]this problem was posted long time ago. I no longer work on this project, therefore, I cannot test it.[/quote]Oops, I didn't see the original date is somewhere in 2009.:crazy:Never mind. Such things happen.;-)</description><pubDate>Thu, 21 Jul 2011 12:19:32 GMT</pubDate><dc:creator>ALZDBA</dc:creator></item><item><title>RE: ISNull Not working</title><link>http://www.sqlservercentral.com/Forums/Topic812342-80-1.aspx</link><description>[quote][b]Faye Fouladi (7/21/2011)[/b][hr]this problem was posted long time ago. I no longer work on this project, therefore, I cannot test it.[/quote]You mean you don't work on the same issue for a year and a half? :hehe:</description><pubDate>Thu, 21 Jul 2011 08:35:22 GMT</pubDate><dc:creator>Jason Selburg</dc:creator></item><item><title>RE: ISNull Not working</title><link>http://www.sqlservercentral.com/Forums/Topic812342-80-1.aspx</link><description>this problem was posted long time ago. I no longer work on this project, therefore, I cannot test it.</description><pubDate>Thu, 21 Jul 2011 08:25:00 GMT</pubDate><dc:creator>Faye Fouladi</dc:creator></item><item><title>RE: ISNull Not working</title><link>http://www.sqlservercentral.com/Forums/Topic812342-80-1.aspx</link><description>There is an Inner join with  a outer joined object, so the inner join on NULL may be your issue .[code="sql"]Inner Join dbo.tblContracts C        ON C.Contract_ID = TBL.TrackingID[/code]So, this may be avoided by altering the inner join to another left joinor maybe better a nested inner join, by shifting the left joined on clause like this.[code="sql"]SELECT  OrgCode AS UnitState      , OrgCode As State      , IsNull(Count(*), 0) As [SLRP Approved]FROM    tLookup_StateTable LKStateLeft Join dbo.tbl_Status_Of_ContractRequests_By_State TBL        on LKState.OrgCode = TBL.UnitStateLEFT Join dbo.tblContracts C        ------ altered inner to left join  (consequences)        ON C.Contract_ID = TBL.TrackingIDLEFT OUTER JOIN dbo.tLookup_Incentive Lkp        ON C.IT_CODE = Lkp.IT_IDWhere   ( TBL.APPROVED &amp;gt; 0 )        AND ( TBL.VERIFIED = 0 )        AND ( TBL.[VERIFICATION FAILED] = 0 )        AND ( TBL.[SYS VERIF - LOSS] = 0 )        AND ( C.ContractStatus = 'A' )        AND C.IT_Code = 'S'Group By OrgCodeSELECT  OrgCode AS UnitState      , OrgCode As State      , IsNull(Count(*), 0) As [SLRP Approved]FROM    tLookup_StateTable LKStateLeft Join dbo.tbl_Status_Of_ContractRequests_By_State TBLInner Join dbo.tblContracts C        ON C.Contract_ID = TBL.TrackingID    on LKState.OrgCode = TBL.UnitState   --- nested inner join with left joinLEFT OUTER JOIN dbo.tLookup_Incentive Lkp        ON C.IT_CODE = Lkp.IT_IDWhere   ( TBL.APPROVED &amp;gt; 0 )        AND ( TBL.VERIFIED = 0 )        AND ( TBL.[VERIFICATION FAILED] = 0 )        AND ( TBL.[SYS VERIF - LOSS] = 0 )        AND ( C.ContractStatus = 'A' )        AND C.IT_Code = 'S'Group By OrgCode[/code]Please test it and let us know your findings !</description><pubDate>Thu, 21 Jul 2011 06:42:44 GMT</pubDate><dc:creator>ALZDBA</dc:creator></item><item><title>RE: ISNull Not working</title><link>http://www.sqlservercentral.com/Forums/Topic812342-80-1.aspx</link><description>Not much information to go on. Run the following code and post back comments.[code="sql"]SELECT 	OrgCode AS UnitState , 	OrgCode As State,	COUNT(*) AS Rows_Per_OrgCode 	--IsNull(Count(*), 0) As [SLRP Approved] FROM tLookup_StateTable LKState Left Join dbo.tbl_Status_Of_ContractRequests_By_State TBL on LKState.OrgCode = TBL.UnitState Inner Join dbo.tblContracts C ON C.Contract_ID = TBL.TrackingID LEFT OUTER JOIN dbo.tLookup_Incentive Lkp ON C.IT_CODE = Lkp.IT_IDWhere (TBL.APPROVED &amp;gt; 0) AND (TBL.VERIFIED = 0) AND (TBL.[VERIFICATION FAILED] = 0) AND (TBL.[SYS VERIF - LOSS] = 0) 	AND (C.ContractStatus = 'A') AND C.IT_Code = 'S'Group By OrgCode[/code]</description><pubDate>Thu, 21 Jul 2011 04:53:37 GMT</pubDate><dc:creator>ChrisM@Work</dc:creator></item><item><title>RE: ISNull Not working</title><link>http://www.sqlservercentral.com/Forums/Topic812342-80-1.aspx</link><description>Just for giggles, try using the caolescle(ltlrim(rtrim(value)), 0) instead of isnull(value, 0)That might work in this case..Aaron</description><pubDate>Thu, 21 Jul 2011 04:16:53 GMT</pubDate><dc:creator>amfrizzell</dc:creator></item><item><title>ISNull Not working</title><link>http://www.sqlservercentral.com/Forums/Topic812342-80-1.aspx</link><description>SELECT OrgCode AS UnitState , OrgCode As State, IsNull(Count(*), 0) As [SLRP Approved] 		 FROM  tLookup_StateTable LKState Left Join dbo.tbl_Status_Of_ContractRequests_By_State TBL  on LKState.OrgCode = TBL.UnitState Inner Join          dbo.tblContracts C ON C.Contract_ID = TBL.TrackingID  				LEFT OUTER JOIN dbo.tLookup_Incentive Lkp ON C.IT_CODE = Lkp.IT_ID              		Where (TBL.APPROVED &amp;gt; 0) AND (TBL.VERIFIED = 0) AND (TBL.[VERIFICATION FAILED] = 0) AND (TBL.[SYS VERIF - LOSS] = 0) AND (C.ContractStatus = 'A') AND C.IT_Code = 'S'        Group By OrgCodeI expect the above code to list all the states and when the count for a particular state is null replace it with zero, but this is not working</description><pubDate>Mon, 02 Nov 2009 06:38:28 GMT</pubDate><dc:creator>Faye Fouladi</dc:creator></item></channel></rss>