How does NULLIF of whitespace equate to empty without using TRIM?

39 Views Asked by At

I have a column with nulls, blanks, and one or more white spaces.

NULLS, blanks and white spaces must be converted to INVALID.

To handle this I'm testing:

COALESCE(NULLIF(COLUMNNAME,''),'INVALID')

I'm surprised to see this handles the white space. I had thought I'd have to replace COLUMNNAME with TRIM(COLUMNNAME).

How does whitespace get automatically handled here? In what scenario would I have had to use TRIM?

0

There are 0 best solutions below