CopySelect *
From Table
Where (col is null or col = '')

Or

CopySelect *
From Table
Where IsNull(col, '') = ''
Answer from codingbadger 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 ... a selection from the Customers table used in the examples: The IS NULL operator is used to test for empty values (NULL values)....
Discussions

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
design - SQL: empty string vs NULL value - Software Engineering Stack Exchange
Let's suppose I have a table with ... columns is an email address with varchar type. We assume that for some reason some people might not want to provide an email address. When inserting such data (without email) into the table, there are two available choices: set cell to NULL or set it to empty string (''). Let's assume that I'm aware of all the technical implications of choosing one solution over another and I can create correct SQL queries for ... More on softwareengineering.stackexchange.com
🌐 softwareengineering.stackexchange.com
December 30, 2010
Query will not return blank results only a null or 0 value
I need to return blank results when there is not a value entered into the table but have only been able to get either a null or 0 value. CASE WHEN PAE.SEX = ‘F’ THEN 1 WHEN PAE.SEX = ‘M’ THEN 0 WHEN PAE.SEX = NULL TH… More on community.spiceworks.com
🌐 community.spiceworks.com
5
3
July 25, 2018
How do I check if a SQL Server text column is empty? - Stack Overflow
I am using SQL Server 2005. I have a table with a text column and I have many rows in the table where the value of this column is not null, but it is empty. Trying to compare against '' yields this More on stackoverflow.com
🌐 stackoverflow.com
🌐
SQLServerCentral
sqlservercentral.com › home › topics › sql server 2008 › t-sql (ss2k8) › check the variable is empty or null
Check the Variable is Empty or Null – SQLServerCentral Forums
September 9, 2014 - Unfortunately there is no way of distinguishing between an unknown value or a missing value in standard sql, hence the NULL. ... Please don't do this... It's one of the things that drove me crazy with c programmers - the incessant urge to use side-effects as functionality.
🌐
Microsoft Learn
learn.microsoft.com › en-us › sql › t-sql › language-elements › null-and-unknown-transact-sql
NULL and UNKNOWN (Transact-SQL) - SQL Server | Microsoft Learn
... Applies to: SQL Server Azure ... Fabric Warehouse in Microsoft Fabric SQL database in Microsoft Fabric · NULL indicates that the value is unknown....
🌐
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 - When applied to a column containing an empty value, it returns NULL, allowing us to check for NULL using the IS NULL operator. While not part of the ANSI SQL standard, NULLIF is a common function available in popular database systems like ...
Find elsewhere
🌐
ThoughtSpot
thoughtspot.com › sql-tutorial › sql-is-null
SQL IS NULL: Find Missing or Empty Values
March 12, 2026 - This is covered in greater detail in the intermediate tutorial, but for now, here's what you need to know: You can select rows that contain no data in a given column by using IS 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 - SELECT Color ,Size ,ProductLine ,Class ,Style FROM dbo.[Product.Test] WHERE (Color IS NULL OR TRIM(Color) = '') OR (Size IS NULL OR TRIM(Size) = '') OR (ProductLine IS NULL OR TRIM(ProductLine) = '') OR (Class IS NULL OR TRIM(Class) = '') OR (Style IS NULL OR TRIM(Style) = '') It helps us ensure there are no empty or meaningless values in the specified column. In addition to SQL queries, Microsoft SQL Server offers built-in functions specifically designed to handle NULL values.
Top answer
1 of 5
2

You do realize you are returning multiple data types in your query? This is not very good query design if the result is a query table.

The data types for 1 and 0 is integer (whether it is int, smallint, or tinyint) while data type for ‘’ is character.

You also need to define what ‘Blank’ is since this is not a proper value definition in MS SQL. I am going to assume that you want ‘Blank’ to be the same as ‘’ which is a zero-length string of type character (whether it is char, varchar, nchar, or nvarchar).

Another common problem is the use of ‘= NULL’ instead of the proper form ‘IS NULL’ since NULL itself is not a value; in simple terms NULL is the absence of a value.

You should read another post here by Larry Shanahan and his included linked post from Robert Sheldon:

Returning a NULL Value when query returns nothing

Post by Robert Sheldon re NULLs

Back to your SQL code - I believe a better simpler version would be one that avoids the use of NULL altogether and would be the following; this also keeps all returned types as character; very close to your 2nd query version:

CASE
    WHEN PAE.SEX = 'F' THEN '1'
    WHEN PAE.SEX = 'M' THEN '0'
    ELSE '' 
    END AS SEX,

@larryshanahan

2 of 5
3

I need to return blank results when there is not a value entered into the table but have only been able to get either a null or 0 value.

CASE

WHEN PAE.SEX = ‘F’ THEN 1
WHEN PAE.SEX = ‘M’ THEN 0
WHEN PAE.SEX = NULL THEN ‘’
END AS SEX,

this returns a null value

CASE

WHEN PAE.SEX = ‘F’ THEN 1
WHEN PAE.SEX = ‘M’ THEN 0
ELSE ‘’
END AS SEX,

this returns a 0 value

🌐
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
In standard SQL, you can use the IS NULL predicate to check if a value is NULL. To check for empty strings, you can use the IS NULL predicate along with the LENGTH function (or its equivalent for your database system) to check if the length ...
🌐
Fdc-inc
accounting.fdc-inc.com › employee › login
Employee - Login
options(empty) defaults(array) actionindex · plugin(null) template/:controller · ==== Sql Log · + Warning No active database connections · ==== Timer · + Peak Memory Use 7.32 MB · Total Request Time: 60 (ms) ==== Log · + There were no log entries made this request ·
🌐
Medium
medium.com › the-data-analyst-toolkit › sql-null-values-d746b8c24bbf
SQL NULL Values. A NULL value in SQL server is a value… | by Emmanuel Segui | The Data Analyst Toolkit | Medium
April 28, 2023 - A NULL value in SQL server is a value that represents the absence of any data. It is not the same as a zero or an empty string. A NULL value means that the value is unknown, undefined, or not applicable.
🌐
Oracle
docs.oracle.com › cd › E40518_01 › server.761 › es_eql › src › reql_sets_is_empty.html
IS_EMPTY and IS_NOT_EMPTY functions
The IS_EMPTY and IS_NOT_EMPTY functions determine whether a set is or is not empty. The IS EMPTY and IS NOT EMPTY functions provide alternative syntaxes for these functions. Note: The IS NULL and IS NOT NULL operations are not supported on sets.
🌐
Oracle
docs.oracle.com › en › database › other-databases › nosql-database › 22.1 › sqlreferencefornosql › is-null-and-is-not-null-operators.html
IS NULL and IS NOT NULL Operators
June 16, 2022 - The IS NULL operator tests whether the result of its input 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. Otherwise, IS NULL returns true if and only if the single item computed ...
🌐
Tutorialspoint
tutorialspoint.com › home › sql › sql is null condition
SQL IS NULL Condition
February 13, 2026 - SELECT * FROM CUSTOMERS WHERE SALARY ... across most SQL databases, but there are slight variations: MySQL: Supports IS NULL and IS NOT NULL in all clauses....
🌐
Microsoft Learn
learn.microsoft.com › en-us › sql › t-sql › queries › is-null-transact-sql
IS NULL (Transact-SQL) - SQL Server | Microsoft Learn
To determine whether an expression is NULL, use IS NULL or IS NOT NULL instead of comparison operators (such as = or !=). Comparison operators return UNKNOWN when either or both arguments are NULL.
🌐
Zod
zod.dev
Intro | Zod
Introduction to Zod - TypeScript-first schema validation library with static type inference