Functionally, you should be able to use

SELECT column_name
  FROM table_name
 WHERE TRIM(column_name) IS NULL

The problem there is that an index on COLUMN_NAME would not be used. You would need to have a function-based index on TRIM(column_name) if that is a selective condition.

Answer from Justin Cave on Stack Overflow
🌐
Logging Experiences
sinairv.wordpress.com › 2012 › 09 › 06 › t-sql-checking-if-a-string-is-empty-or-white-space
T-SQL: checking if a string is empty or white-space | Logging Experiences
September 6, 2012 - Consider a case where you want ... is NULL or an empty string. This is how it can be achieved in Transact-SQL: SELECT ISNULL(NULLIF(SomeTable.SomeColumn, ''), 'Not Available') FROM SomeTable ......
🌐
DQOps
dqops.com › categories of data quality checks - full list › how to detect whitespace and null value placeholders? examples
How to Detect Whitespace and NULL Value Placeholders? Examples
July 22, 2025 - In SQL Server, you can use all generic methods of detecting whitespace characters mentioned in the previous answer. SQL Server also offers specialized functions like CHARINDEX to locate the position of a space within a string, giving you more precise control. The following query will find a space character using TransactSQL in SQL Server: SELECT column_name FROM your_table WHERE CHARINDEX(' ', column_name) > 0 · IS NULL checks if a column value is explicitly defined as NULL, meaning it has no value at all.
🌐
SQLServerCentral
sqlservercentral.com › forums › topic › best-way-to-find-if-string-is-whitespace
Best way to find if string is whitespace – SQLServerCentral Forums
June 25, 2019 - SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies". ... 1 Don't concatenate the strings, that's more overhead, just check the len of each: LEN([address 1]) + LEN([address 2]) + LEN([address 3]) = 0 /*easier, to me*/ OR (LEN([address 1]) = 0 AND + LEN([address 2]) = 0 AND LEN([address 3]) = 0) /*OK too*/ 2 LEN ignores trailing spaces.
🌐
Baeldung
baeldung.com › home › sql queries › find null or empty values in sql
Find Null or Empty Values in SQL Baeldung on SQL
August 20, 2025 - MS SQL provides a function ISNULL to check for null values: SELECT id, name FROM Department WHERE ISNULL(code, '') = '' OR TRIM(code) = ''; The ISNULL function in MS SQL takes two arguments: the first is a value or column name, and the second ...
Find elsewhere
🌐
Actian Communities
communities.actian.com › s › question › 0D53300003rfhTNCAY › how-to-check-if-field-is-null-or-blankor-spaces
How to check if field is NULL or blank(or spaces)?
2025 Actian Corporation. All Rights Reserved · Terms of Use Modern Slavery Policy Privacy Policy Trademark Guidelines Patents Security
🌐
SQLServerCentral
sqlservercentral.com › forums › topic › single-space-and-empty-string
single space and empty string – SQLServerCentral Forums
September 22, 2007 - Whether SQL Server interprets an empty string as either a single space or as a true empty string is controlled by the compatibility level setting. If the compatibility level is less than or equal to 65, SQL Server interprets empty strings as single spaces. If the compatibility level is equal ...
🌐
Ercanopak
blog.ercanopak.com › how-to-check-for-is-not-null-and-is-not-empty-string-in-sql
How to check for ‘IS NOT NULL’ And ‘IS NOT EMPTY’ string in SQL – ErcanOPAK.com
If you want to count any string consisting entirely of spaces as empty · SELECT COLUMN FROM TABLE WHERE COLUMN <> '' If you want to use DATALENGTH for any string consisting entirely of spaces then you must use LTRIM(RTRIM(COLUMN)) before. Post Views: 393 · Get the User Name and Domain Name ...
🌐
Alteryx
community.alteryx.com › t5 › Alteryx-Server-Discussions › SQL-query-for-empty-string-data-type › td-p › 960668
Solved: SQL query for empty string data type - Alteryx Community
June 29, 2022 - Hi, I am trying to use a SQL query in Input tool, to get a portion of data from a server, and I need to ask for "not empty" values. the column is string, so when I use "is not null" it doesn't work. can someone help me what should I use instead to get not empty values? here is my SQL: SELECT RPPO, RPPDCT, RPOBJ, RPSUB, RPVINV, RPDIVJ, RPLNID, RPPYIN, RPSBL, RPSBLT, RPDOC FROM JDESTAGE.F0411_LT where RPDIVJ>=122001 and RPPO is not NULL ... Solved! Go to Solution. ... Solved! Go to Solution. ... I did try this but didn't work out. ... @tectonics25 are you getting an error message? Or it’s just leaving empty values in? Can you check what they actually are like are your empties 5 x white space for example?