IS NOT NULL condition in SQL Server
This SQL Server tutorial shows how to use the IS NOT NULL condition along with specific syntax and examples.
This SQL Server tutorial shows how to use the IS NOT NULL condition along with specific syntax and examples.
The IS NOT NULL condition in SQL Server is used to check if the value is NOT NULL. A NULL value in a table is a value in an empty field, in other words, a field with no value.
Syntax syntax IS NOT NULL
'expression' IS NOT
NULL
Variable name or variable value
Note
- The expression whose value NOT NULL is returned is TRUE
- The expression whose value NULL is returned is FALSE
For example - SELECT command
Example IS NOT NULL condition in SQL Server SELECT statement.
SELECT *
FROM nhanvien
WHERE ho IS NOT NULL;
This example returns all records from the user table whose employee information field contains no NULL values (not left blank).
Example - INSERT command
INSERT INTO danhba
(danhba_id, ho, ten)
SELECT nhanvien_id, ho, ten
FROM nhanvien
WHERE ho IS NOT N
ULL;
This command will insert the record into the namba table if the employee's last name in the table is not NULL.
Example - UPDATE command
UPDATE nhanvien
SET tinhtrang = 'Active'
WHERE ho IS NOT NULL;
The records in the table that have them are not NULL values will be updated.
Example - DELETE command
DELETE FROM nhanvien
WHERE tinhtrang IS NOT NULL;
In this example, all records from the table have a 'status' information field that does not contain a NULL value that will be deleted.
Previous article: IS NULL condition in SQL Server
Next article: Condition LIKE in SQL Server
You should read it
- IS NULL condition in SQL Server
- SQL way to count NULL and NOT NULL values in a column
- How to Check for Null in Java
- NULL value in SQL
- Foreign Key with Set Null in SQL Server
- How to Check Null in Java
- What is / dev / null in Linux?
- Learn Null Session attacks
- Cursor NULL in C / C ++
- How to Check Null in C
- ISNULL function in SQL Server
- Microsoft Windows PowerShell and SQL Server 2005 SMO - Part 10