Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
Mondeo
Constraint Violating Yak Guru
287 Posts |
Posted - 2008-09-30 : 12:20:45
|
| I've got a bit column in my database.I noticed that this statement does not return rows with NULL in that columnSELECT * FROM table WHERE bitColumn <> 1This works howeverSELECT * FROM table WHERE (bitColumn <> 1 OR bitColumn IS NULL)I was just wondering why that is the case?Thanks |
|
|
Vinnie881
Master Smack Fu Yak Hacker
1231 Posts |
Posted - 2008-09-30 : 12:33:33
|
a null value means a value is non existant, therefore it can not compare it to anything.Also you can useSELECT * FROM table WHERE coalesce(bitColumn,0) <> 1 Success is 10% Intelligence, 70% Determination, and 22% Stupidity.\_/ _/ _/\_/ _/\_/ _/ _/- 881 |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-09-30 : 12:39:58
|
quote: Originally posted by Vinnie881 a null value means a value is non existant, therefore it can not compare it to anything.Also you can useSELECT * FROM table WHERE coalesce(bitColumn,0) <> 1 Success is 10% Intelligence, 70% Determination, and 22% Stupidity.\_/ _/ _/\_/ _/\_/ _/ _/- 881
Which is true unless you've set ANSI NULLS property to OFF |
 |
|
|
|
|
|