How to check for null/empty/whitespace values with a single test?

The NULLIF function will convert any column value with only whitespace into a NULL value. Works for T-SQL and SQL Server 2008 & up.
SELECT [column_name]
FROM [table_name]
WHERE NULLIF([column_name], '') IS NULL

Comments

Popular posts from this blog

How to Clean C Drive & Get BACK 150GB+ Space Instantly — 8 SUPER Ways

PHP: Calculate the percentage of a number.