Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 translate

Author  Topic 

beatkeeper25
Starting Member

27 Posts

Posted - 2013-08-06 : 15:41:01
Can someone translate what this line is doing?

AND ISNULL(a.completiondate,0)<ISNULL(b.completiondate,0)

what is the purpose of the ,0 ?

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2013-08-06 : 15:42:51
,0 is due to the ISNULL function. If the column is null, then use zero instead.


Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2013-08-07 : 00:55:37
basically the purpose of this is to handle NULL values as well. If you just use it like below

a.completiondate < b.completiondate

it will cause the cases where one of the column values is NULL to be ignored as operators like <,> etc will ignore NULL under default conditions (ANSI NULL settings) in SQL Server

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs
Go to Top of Page
   

- Advertisement -