I really need a new picture  

What I Learned About SQL on August 7, 2004 2004 Feb 08

(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’

Joe Crawford blogged this at 2:20pm in 2004 in February. The 8th was a Sunday. You are reading this 16 years later. Comment. There are no comments Tweet. Send email. It has no hastags.

Leave a Reply

Comments Open; Trackbacks Open.