Checking database for NULL boolean value
21,535
Solution 1
In TSQL, you need to use IS
rather than =
when comparing with NULL
:
SELECT * FROM table WHERE field IS NULL
Solution 2
Try
select * from table where field IS null
Solution 3
You want IS NULL
I believe:
SELECT * FROM table WHERE field IS NULL
Author by
Ben Everard
I'm Ben, co-founder and developer at The Idea Bureau.
Updated on July 09, 2022Comments
-
Ben Everard almost 2 years
I have a field in a table that is boolean, a range of records have no value (not true or false). How do I write my SQL statement to find these?
I have tried the following SQL statements without success:
1) SELECT * FROM table WHERE field = NULL 2) SELECT * FROM table WHERE field != TRUE AND field != FALSE
Any help would be greatly appreciated.
Many Thanks, Ben