This is about a bizarre behaviour I found in Microsoft Sql Server. Please correct me if I'm wrong.
SELECT COUNT(*) FROM TABLEA
WHERE [Column1] IS NULL;
This returns 30018 rows.
CREATE VIEW VIEWB AS
SELECT * FROM TABLEA AS t1
WHERE t1.[Column1] NOT IN ('Cross/Up sell', 'Renegotiation', 'Renewal')
If I check VIEWB
, I don't find NULL
in Column1
:
SELECT COUNT(*) FROM VIEWB
WHERE [Column1] IS NULL;
This returns 0 rows.
Why? The query above excludes the 3 values, but it isn't supposed to exclude NULL. Why does Ms Sql Server behave this way? Should I have expected this?
How can I fix it?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…