Not equal <> != operator on NULL

后端 未结 11 1529
南旧
南旧 2020-11-22 02:50

Could someone please explain the following behavior in SQL?

SELECT * FROM MyTable WHERE MyColumn != NULL (0 Results)
SELECT * FROM MyTable WHERE MyColumn <         


        
11条回答
  •  盖世英雄少女心
    2020-11-22 03:32

    We use

    SELECT * FROM MyTable WHERE ISNULL(MyColumn, ' ') = ' ';
    

    to return all rows where MyColumn is NULL or all rows where MyColumn is an empty string. To many an "end user", the NULL vs. empty string issue is a distinction without a need and point of confusion.

提交回复
热议问题