The SQL code compares the count(*) and count(id) and if the difference is more than 0 it means null exist.
The SQL code compares the count(*) and count(id) and if the difference is more than 0 it means null exist.
create table test (id int) INSERT INTO TEST VALUES (1) INSERT INTO TEST VALUES (2) INSERT INTO TEST VALUES (null) SELECT COUNT(*) AS A,COUNT(ID) as B,A - B AS TEST, CASE WHEN TEST >0 THEN 'NULL EXIST' ELSE 'NULL DOES NOT EXIST' END FROM TEST ABTESTCASE 321NULL EXIST