If you only want to match "" as an empty string

WHERE DATALENGTH(COLUMN) > 0 

If you want to count any string consisting entirely of spaces as empty

WHERE COLUMN <> '' 

Both of these will not return NULL values when used in a WHERE clause. As NULL will evaluate as UNKNOWN for these rather than TRUE.

CREATE TABLE T 
  ( 
     C VARCHAR(10) 
  ); 

INSERT INTO T 
VALUES      ('A'), 
            (''),
            ('    '), 
            (NULL); 

SELECT * 
FROM   T 
WHERE  C <> ''

Returns just the single row A. I.e. The rows with NULL or an empty string or a string consisting entirely of spaces are all excluded by this query.

SQL Fiddle

Answer from Martin Smith on Stack Overflow
🌐
W3Schools
w3schools.com › sql › sql_null_values.asp
SQL NULL Values - IS NULL and IS NOT NULL
SELECT column_names FROM table_name WHERE column_name IS NOT NULL; Below is a selection from the Customers table used in the examples: The IS NULL operator is used to test for empty values (NULL values).
🌐
Mimo
mimo.org › glossary › sql › is-not-null
SQL IS NOT NULL Condition: Syntax, Usage, and Examples
# SQL IS NOT NULL: Syntax, Usage, and Examples The `SQL IS NOT NULL` condition checks whether a column contains a value rather than being empty. In SQL, a `NULL` represents missing or undefined data—not the number zero, an empty string, or false. Use `IS NOT NULL` to return rows where values ...
🌐
Reddit
reddit.com › r/sql › how to handle a value which is not null but also not an empty string?
r/SQL on Reddit: How to handle a value which is not null but also not an empty string?
March 12, 2024 -

I have a table which contains some values which are not null. I thought it might be an empty sting but it was not an empty string either.

I copied that particular field from the table and tried an update statement to convert it into null but it didn't worked either . Kindly suggest something

🌐
GeeksforGeeks
geeksforgeeks.org › sql server › how-to-check-a-column-is-empty-or-null-in-sql-server
How to Check a Column is Empty or Null in SQL Server - GeeksforGeeks
January 31, 2024 - ... Expression can be a column name and replacement is the string value which will replace the column value. ... The function NOT ISNULL() is just the opposite of ISNULL() Function explained above and returns all records without NULL, Empty, ...
🌐
Hightouch
hightouch.com › sql-dictionary › sql-is-not-null
SQL IS NOT NULL - Syntax, Use Cases, and Examples | Hightouch
December 29, 2023 - The IS NOT NULL operator allows you to select rows where a particular column contains data, ensuring that the data exists and is not missing. You would use the SQL IS NOT NULL operator when you need to filter data from a table based on whether ...
🌐
Google Support
support.google.com › docs › thread › 59147466 › using-is-not-empty-or-is-not-blank-as-a-select-where-criteria
Using "is not empty" or "is not blank" as a SELECT WHERE criteria - Google Docs Editors Community
Skip to main content · Google Docs Editors Help · Sign in · Google Help · Help Center · Community · Google Docs Editors · Terms of Service · Submit feedback · Send feedback on
🌐
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 - We can use the function NULLIF to compare and check if the column contains null or empty values: SELECT id, name FROM Department WHERE NULLIF(TRIM(code), '') IS NULL; The NULLIF function evaluates its two arguments, returning NULL if they are equal.
Find elsewhere
🌐
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 - 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?
🌐
SQLServerCentral
sqlservercentral.com › forums › topic › check-the-variable-is-empty-or-null
Check the Variable is Empty or Null – SQLServerCentral Forums
September 9, 2014 - Edit: sql code tag messed up my "greater than" symbol. You may do it... sometimes... But it is NOT right. Try this: ... If you want to make sure that your varchar value contains some thingelse than NULL and empty string use simple "NOT EQUAL" eg:
🌐
Coginiti
coginiti.co › home › beginner › sql is null
What is the IS NULL Operator in SQL? - Coginiti
September 25, 2023 - In addition to the IS NULL operator, SQL also provides the IS NOT NULL operator, which is used to test for non-NULL values in a column. ... As a result, you would see the rows that are not empty or do not have NULL values.
🌐
SQLTeam
forums.sqlteam.com › sql server administration
How to see non null values? - SQL Server Administration - SQLTeam.com Forums
July 8, 2022 - I have a table which does not allow nulls in ColumnA. When I select * where ColumnA is not null, millions of rows are returned, most of them have no visible value . They may contain 1 or more spaces but how can I know…
🌐
TechOnTheNet
techonthenet.com › sql › is_not_null.php
SQL: IS NOT NULL Condition
This example will delete all records from the orders table where the customer_id does not contain a NULL value.
🌐
Oracle
docs.oracle.com › cd › E40518_01 › server.761 › es_eql › src › reql_sets_is_empty.html
IS_EMPTY and IS_NOT_EMPTY functions
IS_EMPTY(<set>) where set is a set of any set data type (such as mdex:string-set or mdex:long-set). For example, set can be a multi-assign double attribute. Examples of two results are as follows (note that { } indicates an empty set):
🌐
Quora
quora.com › What-is-the-standard-SQL-query-for-checking-null-or-empty-strings
What is the standard SQL query for checking null or empty strings? - Quora
Answer (1 of 2): In standard SQL, you can use the [code ]IS NULL[/code] predicate to check if a value is [code ]NULL[/code]. To check for empty strings, you can use the [code ]IS NULL[/code] predicate along with the [code ]LENGTH[/code] function ...
🌐
TutorialsPoint
tutorialspoint.com › need-help-selecting-non-empty-column-values-from-mysql
Need help selecting non-empty column values from MySQL?
SELECT * FROM yourTableName WHERE yourColumnName IS NOT NULL AND TRIM(yourColumnName) <> ' '; You can select non-empty value as well as whitespace from column using the same TRIM() function.
🌐
W3Schools
w3schools.com › sql › sql_notnull.asp
SQL NOT NULL Constraint
SQL Examples SQL Editor SQL Quiz SQL Exercises SQL Server SQL Syllabus SQL Study Plan SQL Bootcamp SQL Certificate SQL Training ... By default, a column can hold NULL values. The NOT NULL constraint enforces a column to NOT accept NULL values.
🌐
MSSQLTips
mssqltips.com › home › sql where is not null examples
SQL WHERE IS NOT NULL Examples
March 13, 2023 - Using the IS NOT NULL statement as an additional parameter setting in the WHERE clause will allow us to filter out very specific data. In this SQL tutorial, we will discuss how to use the WHERE IS NOT NULL operator in SQL Server and explore some examples of using it in real-world scenarios.
🌐
Programiz
programiz.com › sql › is-null-not-null
SQL IS NULL and IS NOT NULL (With Examples)
Here, the SQL query retrieves the count of all the rows from the Employee table where the value of the email column is NULL. ... Similarly, we can use the COUNT() function with IS NOT NULL to count the number of non-empty fields.