I really need a new picture  

What I Learned About SQL on August 7, 20042004Feb08

(File under: Posts that were meant to be but never were)

  1. COALESCE() – the ANSI standard
  2. ISNULL() – the Microsoft T-SQL standard (only takes two values)
  3. IFNULL() – the MySQL standard (only takes two values)
  4. NVL() – Oracle / Informix PL/SQL standard (only takes two values)

Got that from a message board.

Basically it takes a query result, and in order of the parameters, if the first is NULL, then it uses the second parameter (often a string or ‘N/A’ or whatever.

SQL Server: Coalesce()

SQL Server: Isnull()

Kind of useful when you want to munge strings — because anything + NULL is always null, you can avoid that by doing

COALESCE(TABLE.WHATEVER,”)+ ‘anything’

wrote this Sunday February 8th 2004 at 2:20pm That was 18 years ago. Leave a comment

Leave a Reply