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
The IS NOT NULL operator is used to test for non-empty values (NOT NULL values). The following SQL lists all customers with a value in the "Address" field: SELECT CustomerName, ContactName, Address FROM Customers WHERE Address IS NOT NULL; Try ...
Discussions

Check the Variable is Empty or Null โ€“ SQLServerCentral Forums
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: More on sqlservercentral.com
๐ŸŒ sqlservercentral.com
September 9, 2014
How to handle a value which is not null but also not an empty string?
Use nullif() SELECT NULLIF(museum_id, '') More on reddit.com
๐ŸŒ r/SQL
12
5
March 12, 2024
SQL Newbie question about NOT NULL
NOT NULL in the schema context means that the data in the table must contain a value for that column. More on reddit.com
๐ŸŒ r/SQL
6
6
March 26, 2024
What is a null in sql? is it the same as a empty cell?
NULL, in simplest terms, is the absence of data. Not to be confused with '', an empty string. If you are familiar with other languages, you could think of it as similar to undefined, in that the column has a type defined, but the specific cell has no data, and is more of a place holder for future data. When filtering for NULL, you will need to do things like table.col is null or table.col is not null In your Excel example, it depends on how you import the data, and what the definition of the target table is. The target table may have rules built into it to default the data for certain columns, or reject NULL values from other columns. You could have Null, an empty string, zero, weird dates.. etc. More on reddit.com
๐ŸŒ r/learnSQL
10
13
October 5, 2022
๐ŸŒ
Baeldung
baeldung.com โ€บ home โ€บ sql queries โ€บ find null or empty values in sql
Find Null or Empty Values in SQL Baeldung on SQL
August 5, 2026 - SELECT id, name FROM Department ... the first non-NULL value from a list of arguments. COALESCE(code, โ€) returns the value of the column code if it is not NULL....
๐ŸŒ
Mimo
mimo.org โ€บ glossary โ€บ sql โ€บ is-not-null
SQL IS NOT NULL Condition: Syntax, Usage, and Examples
Use SQL IS NOT NULL in a WHERE clause to filter out records that contain empty or missing values in a column.
๐ŸŒ
W3Schools
w3schools.com โ€บ mysql โ€บ mysql_null_values.asp
MySQL NULL Values - IS NULL and IS NOT NULL
SELECT column_names FROM table_name ... the "Customers" table in the Northwind sample database: The IS NULL operator is used to test for empty values (NULL values)....
๐ŸŒ
MSSQLTips
mssqltips.com โ€บ home โ€บ sql where is not null examples
SQL WHERE IS NOT NULL Examples
March 13, 2023 - ... The WHERE clause in SQL is used to specify the criteria for selecting data from a database table. This clause can also filter out data with some conditions, such as specifying only rows where a certain column or columns are not null.
๐ŸŒ
GeeksforGeeks
geeksforgeeks.org โ€บ mysql โ€บ how-to-check-a-column-is-empty-or-null-in-mysql
How to Check a Column is Empty or Null in MySQL? - GeeksforGeeks
February 2, 2024 - To ascertain if a column is empty or null in SQL, use COALESCE(column, '') or column IS NULL OR column = ''. These queries fetch rows where the specified column contains an empty string or null value, ensuring comprehensive coverage of both ...
Find elsewhere
๐ŸŒ
SQLServerCentral
sqlservercentral.com โ€บ home โ€บ topics โ€บ 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:
๐ŸŒ
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 - In the above sample output, we can see data without any NULL values, meaning records with NULL values are removed from the result output. It is to be noted that empty string value or column with spaces are displayed in the output if it is there and only NULL is filtered out.
๐ŸŒ
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

๐ŸŒ
DotFactory
dofactory.com โ€บ sql โ€บ where-isnull
SQL IS NULL | IS NOT NULL
List customers that have not placed any orders. SELECT C.Id, FirstName, LastName, TotalAmount FROM Customer C LEFT JOIN [Order] O ON C.Id = O.CustomerId WHERE TotalAmount IS NULL Try it live
๐ŸŒ
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 3): 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 (or its equivalent for your database system) to che...
๐ŸŒ
Programiz
programiz.com โ€บ sql โ€บ is-null-not-null
SQL IS NULL and IS NOT NULL (With Examples)
It has the following syntax: SELECT column1, column2, ... FROM table WHERE column_name IS NULL; ... Here, the above SQL query retrieves all the rows from the Employee table where the value of the email column is NULL. ... Note: Empty values are considered NULL.
๐ŸŒ
Devart
devart.com โ€บ home โ€บ how to โ€บ how to handle null or empty values in sql server
How to Handle Null or Empty Values in SQL Server
December 19, 2024 - Consider the following factors ... filtering might not efficiently use indexes. To avoid issues, use filtered indexes to include only non-NULL or relevant rows (e.g., WHERE Column IS NOT NULL)....
๐ŸŒ
Oracle
docs.oracle.com โ€บ en โ€บ database โ€บ other-databases โ€บ nosql-database โ€บ 20.3 โ€บ sqlreferencefornosql โ€บ is-null-and-is-not-null-operators.html
IS NULL and IS NOT NULL Operators
is_null_expression ::= ... is NULL. If the input expression returns more than one item, an error is raised. If the result of the input expression is empty, IS NULL returns false....
๐ŸŒ
Wyzant
wyzant.com โ€บ resources โ€บ ask an expert
How to check for Is not Null And Is not Empty string in SQL server? | Wyzant Ask An Expert
May 6, 2019 - How can we check in a SQL Server `WHERE` condition whether the column is not null and not the empty string (`''`)? ... Larry C. answered ย• 05/12/19 ... Get a free answer to a quick problem. Most questions answered within 4 hours. ... Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.
๐ŸŒ
Hightouch
hightouch.com โ€บ sql-dictionary โ€บ sql-is-not-null
SQL IS NOT NULL - Syntax, Use Cases, and Examples | Hightouch
December 29, 2023 - You would use the SQL IS NOT NULL operator when you need to filter data from a table based on whether a column's value is not NULL. This is useful when you want to retrieve records with data present in a specific column or attribute, ensuring ...
๐ŸŒ
Microsoft Learn
learn.microsoft.com โ€บ en-us โ€บ sql โ€บ t-sql โ€บ queries โ€บ is-null-transact-sql
IS [NOT] NULL (Transact-SQL) - SQL Server | Microsoft Learn
July 20, 2026 - SELECT Name, Weight, Color FROM Production.Product WHERE Weight < 10.00 OR Color IS NULL ORDER BY Name; GO ยท The following example returns the full names of all employees with middle initials. SELECT FirstName, LastName, MiddleName FROM DIMEmployee WHERE MiddleName IS NOT NULL ORDER BY LastName DESC;
๐ŸŒ
Tutorialspoint
tutorialspoint.com โ€บ sql โ€บ sql-is-not-null.htm
SQL - IS NOT NULL Operator
To check whether the table has been updated or not, execute the SELECT query below: ... The IS NOT NULL operator can also be used in combination with SQL JOIN clauses to retrieve only those matching records where a certain column has a non-null ...