home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.databases.ms-sqlserver      Notorious Rube Goldberg contraption      19,505 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 18,075 of 19,505   
   Erland Sommarskog to Gene Wirchenko   
   Re: Case with NULL   
   14 Jan 11 23:13:32   
   
   From: esquel@sommarskog.se   
      
   Gene Wirchenko (genew@ocis.net) writes:   
   >      Not the adjective I would have picked.   
      
   You're not Swedish, are you? :-)   
      
   > Is there a technical difference that matters?   
      
   Well, it was the one I used:   
      
   >>Say that you write:   
   >>   
   >>  coalesce((SELECT ....), 4711)   
   >>   
   >>Looks good. But this is the true story:   
   >>   
   >>   CASE WHEN (SELECT ...) IS NOT NULL THEN (SELECT ...) ELSE 4711 END   
   >>   
   >>Personally, I use coalesce all the time.   
      
   When you use CASE, you easier realise that the subquery is computed   
   twice.   
      
      
   --   
   Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se   
      
   Links for SQL Server Books Online:   
   SQL 2008: http://msdn.microsoft.com/en-us/sqlserver/cc514207.aspx   
   SQL 2005: http://msdn.microsoft.com/en-us/sqlserver/bb895970.aspx   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca